How to hook up alpha channel of a texture in C++?

Finally i got it!

First you need to tell it, to use the texture expression for the opacity mask:

material->OpacityMask.Expression = TextureExpression;

After that you need to activate a mask for the opacity mask input:

material->OpacityMask.Mask = 1;

And then you can switch on/ off which of the channels you are going to need:

material->OpacityMask.MaskR = 0;
material->OpacityMask.MaskG = 0;
material->OpacityMask.MaskB = 0;
material->OpacityMask.MaskA = 1;
1 Like