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 can I create a dynamic opacity mask with an unspecified amount of sphere masks?

I'm working on a project where objects of a certain material should only be visible where they are inside a sphere of a certain class. I have followed the "Location Based Opacity" tutorial and managed to get it working with two spheres using material parameters.

alt text

The way it works now is hardcoded, I have two spheres of the same class, each writes its position and radius to its own parameter in a material parameter collection, then in the material blueprint (manually repeated per sphere) I read those two parameters and create a sphere mask, which I add together and apply as opacity mask

material blueprint

The problem is that this solution is not scalable to an indeterminate number of spheres that might even be spawned at runtime. I thought about writing a custom shader, but the documentation on the subject is not all that clear about stuff like uniforms, shader language and where to actually place the shader.

I am willing to do this with blueprints if possible, but the functionality that is available in the material blueprints is severely limited for this purpose, and I dont believe I can add material parameters to a collection dynamically, or even do a for-each for every parameter in a collection at all and add those results in a single mask.

Any help would be appreciated.

Product Version: UE 4.9
capture.png (208.0 kB)
untitled.png (2.4 MB)
more ▼

asked Sep 11 '15 at 06:42 PM in Rendering

avatar image

51 2 4 9

avatar image Thokash Oct 26 '15 at 10:52 AM

I would also like to know about this. From what I've read, most people suggest making a parameter for every sphere but there's gotta be another way to do it. One that allows you to dynamically create as many or few as you need.

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

0 answers: sort voted first
Be the first one to answer this question
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