[solved]How to set opacity on textures?

How can you set opacity/transparency on textures or texture-stages? Is there any way beside loading or generating an alpha map?

I found generateAlphaScaleMap() in Texture, but I have no idea how to use that. Same for TextureStage.setAlphaScale()

Thanks in advance

In general, the only way to set the alpha channel on a texture is to load or generate an alpha map.

This is not the same thing as transparency. Alpha is usually used to indicate transparency, but it could also be used for other things, instead. For instance, it can be used in conjunction with an appropriate shader to indicate the amount of glow or gloss that should be applied.

But, if you want to vary transparency according to the texture UV’s, then it pretty much means you’re going to load an alpha map onto your texture.

David

Ok, thanks.
I guess I’ll generate a 1x1 texture on the fly then and apply that as alpha.

If you only want a constant transparency level across an model, you can use model.setAlphaScale() to achieve this.

If you are constructing a complex stack of TextureStages, and you need a certain constant alpha value on one of the stages, you might able to use TextureStage.setColor() for this.

David

I need it for a particular stage, but TextureStage.setColor() seems to have no effect.

It has no effect on its own. You also have to specify a CombineSource of CSConstant on setCombineAlpha() for the TextureStage in question. This also means you have to use setCombineRgb(), of course, instead of one of the simpler modes.

David

Using TextureStage.CMInterpolate worked just fine. Thanks.