Jump to content

Alpha on PNG, mtls and objs


Pryme8
 Share

Recommended Posts

So basically I know this has been asked before... but Im not sure how he got to his solution after reading through this:

show.jpg.b513f7ee7ed948a7df93725728f62fba.jpg

Is what I am getting right now and this is my mtl file:
 

# WaveFront *.mtl file (generated by CINEMA 4D)

newmtl Trunk_oak
Kd 0.80000001192093 0.80000001192093 0.80000001192093
map_Kd bark1_color.jpg
illum 7

newmtl Leafs_Oak
Kd 0.80000001192093 0.80000001192093 0.80000001192093
map_Kd branch1_color.png
Ks 1 1 1
Ns 43.219
illum 7

Ive done this in the past by stripping out the mtl file and just assigning the materials manually, but I am trying to avoid that. 

Link to comment
Share on other sites

Yes and no :) Yes because it will work but no because it will turn alpha blending on on all meshes using this texture which will drastically slow down the rendering (not mentioning the depth sorting issues)

Link to comment
Share on other sites

hmmm so,  maybe once the texture is loaded from the mtl file test a few pixels for alpha or not.   So like every corner the middle and like every 1/6th width/height point so like 36 points which would be minimal load but if any of the points tick off as having an alpha other then 1 then you know there is an alpha pass?

Maybe I am just over complicating this.

Link to comment
Share on other sites

We could also script in like BJS specific strings in the mtl files that our parser could handle.

https://github.com/BabylonJS/Babylon.js/blob/master/loaders/src/OBJ/babylon.objFileLoader.ts#L152

So like add
 

else if(key=='bjs_alpha' && material){
 if(value==1){...}else{}
}else if(key=='bjs_alpha_pass' && material){
  ...
}

 

Link to comment
Share on other sites

I might have to harass you about this at some point.  If I get some time Ill see about setting this up and if I have any problems ill pm you.

Its tough to submit PR's without even getting to test it.  Cause otherwise its like hmmm cross your fingers and hope you know what you are doing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...