Is it possible for a texture to have transparent areas (i.e. hasAlpha = true
) but also have an alpha value for the entire parent material (alpha = 0.5
)?
If not, is there any workarounds? I’m trying to create a button with areas that have 50% opacity as well as total transparency…
Hiya Lump! Great question! Good playground demo, too.
Umm… have you ever played-with material opacityTexture?
https://www.babylonjs-playground.com/indexStable.html#NAIEGS#1
I did some goofing-around, there. I changed lines 42 and 43, and added a level adjuster in line 44.
Is that right sphere looking “close-to” what you wish? The edges seem a little “soft” but there might be MANY advanced adjustments on BJS Texture class… which could affect this. Perhaps blendModes and samplingModes? (I’m not very experienced in advanced texture operations).
All in all, it’s something new for you to play-with. Good luck, stay tuned for more/better comments, and teach us things you learn, ok? Thx.
material.useAlphaFromDiffuseTexture = true;
should do the trick
https://www.babylonjs-playground.com/indexStable.html#NAIEGS#2