x

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"

Get Opacity mask from material in C++?

Hello,

Is there a way to get the opacity mask used by a material from C++? I'm rendering on UPanelCanvas and I need to hide all of the UImage objects that are underneath the zero opacity area.

circular opacity mask

So basically if I have a mask like the one illustrated above, everything within the white area shall be rendered and everything outside it, thus being in the black area shall not be rendered.

Am I missing something? Is there perhaps a better solution to it?

Thanks in advance.

P.S.: forum link

Product Version: UE 4.12
Tags:
circularmask.png (143.1 kB)
more ▼

asked Oct 24 '16 at 04:29 PM in C++ Programming

avatar image

Alisaxy
78 5 7 10

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey Alisaxy-

The material class has an opacity mask variable that you can access publicly. If you have a material pointer, you can use this to get the opacity mask as necessary:

 UMaterial* MyMaterial;
 MyMaterial->OpacityMask;

Cheers

Doug Wilson

more ▼

answered Oct 25 '16 at 01:47 PM

avatar image Alisaxy Oct 25 '16 at 05:26 PM

I've actually solved the problem without needing an opacity mask at all using UCanvasRenderTarget2D instead of UCanvasPanel. I imagine a need to mess around with FMaterialCompiler to get the data I need from the opacity mask and even then I wouldn't be able to partially hide the panel slots outside the mask as it's an all or nothing deal that way.

Nice to know still. :) Thanks!

avatar image Alisaxy Oct 25 '16 at 05:43 PM

Ah, found why I couldn't find it myself. :D I was confused by UMaterialInstanceDynamic & UMaterial, they're on different inheritance branches! I was always looking at the former, not the latter. Dang it! :) Well, the best experience is gained from making mistakes. Dully noted!

(comments are locked)
10|2000 characters needed characters left
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