Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

i try to generate a bunch of materials with a plugin function in C++. Basically for each materail i have one texture an wanna hook it up to the material blueprint node in a way shown i this picture: alt text

the upper connection (RGB to Base Color) is no problem i do this with the following line of code:

 UMaterial* material = ... ;
 UMaterialExpressionTextureSample* TextureExpression = ... ;
 material->BaseColor.Expression = TextureExpression;

I just cant figure out, how to connect the A with the Opacity Mask. Any suggestions are very welcome.

Product Version: UE 4.22
ue4.png (60.1 kB)
more ▼

asked Aug 09 '19 at 07:06 PM in C++ Programming

avatar image

1 2 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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;
more ▼

answered Aug 12 '19 at 09:35 PM

avatar image

1 2 1 1

avatar image MCX292 6 days ago

That was a tough one - I'm going to keep this one around because I'm sure I will forget.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question