Model opacity channel


Uploading: 微信截图_20211231164417.png…
Hi
I am using sandbox for the first time, maybe this is a silly little problem.I want to test the opacity on this plane.But in the sandbox I added this texture in opacity channel but he rendered a different effect than I did in 3dsmax, is there something wrong with my settings?

Sorry, the second picture is not displayed

3DS max seems to use the RGB values of the opacity texture as alpha (so, darker regions with a lower RGB will have less alpha and be more transparent), while Babylon is using the alpha value itself (so, the actual texture transparency, no matter the RGB value).

Thanks for your answer I seem to understand what you mean but it still didn’t work.In PS I use four channels of RGBA but when I export to TGA format it is not recognized and when I use PNG format the alpha channel is white.The alpha value is successful when my colleague uses alpha=0.6 in his code.But I want to make a gradient effect in babylon.

You can use texture.setAlphaFromRGB to use the texture’s RGB value as alpha:
Opacity texture RGB | Babylon.js Playground (babylonjs.com)

2 Likes

Sorry to ask you again.I tried to add this texture to the opacity channel in the sandbox.I guess maybe my transparency menu is wrong, there are many combinations of transparency mode and alpha mode, can you help me look again?

I don’t think you can change setAlphaFromRGB from the Inspector, it has to be through code.

@carolhmj could you add it into the inspector ? if not, I ll do it :slight_smile:

I sure can!

Add setAlphaFromRGB to Texture on Inspector · Issue #11714 · BabylonJS/Babylon.js (github.com) issue up, will start on it :grinning_face_with_smiling_eyes:

2 Likes

Thank you for your help. Have a nice day~

1 Like

Transform getAlphaFromRGB into a property with accessors and dirty th… by carolhmj · Pull Request #11715 · BabylonJS/Babylon.js (github.com) Merged, will be up on the next release! <3

2 Likes