Is it possible to have a texture with transparent areas and an alpha value?

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…

Playground displaying the conflict.

Hiya Lump! Great question! Good playground demo, too.

Umm… have you ever played-with material opacityTexture?

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.

1 Like

material.useAlphaFromDiffuseTexture = true; should do the trick :wink:


@Vinc3r that’s exactly what I needed, I must have missed it in the docs. Thanks!

@Wingnut the opacity texture is new to me for sure! It’s quite a cool effect, I’m sure I will play around with it at some point :wink:

1 Like