Sphere Mask on each instance of an Instanced Static Mesh

I’m trying to build instanced static mesh billboards for my project, but am having trouble getting the lighting and opacity masking correct. The billboards should just represent spheres, so I wanted to apply a sphere mask to each instance, but when I use the mask, it seems like only one is showing up in the game (as opposed to one per instance). The closest post I found that relates to my issue is this one: https://answers.unrealengine.com/questions/484539/foliage-instance-position-in-material-editor.html.

But I don’t quite understand how to implement the response.

To get the billboard effect, I just reused example 2.20 in the Math Hall (https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/MathHall/index.html) and replaced the “Actor Position” node with “Object Pivot Point”. Here’s the material blueprint I have so far:


How can I modify this further to apply a sphere mask to each of my instanced meshes? Any help is appreciated!

Instance position in worldspace is retrievable like this:

I believe that you can also use vertex interpolator node as 4.16 for a more tidy look, but I haven’t tested it.

Thanks! I tried to implement what’s in the picture you provided and I managed to get the sphere mask to appear, however it only shows up at the origin (where my instanced mesh actor is located). Is there a way to get the sphere mask to apply to every instance of that mesh?

Here’s my current material setup:

Does anyone know how I can do that?

Required offset from the pivot should go into the (0,0,0), that you are transforming from local to world.

Wait…realized what I did wrong. Changed my TexCoord[2] and TexCoord[3] to TextCoord[0] and TexCoord[1] (to match the customized UVs). As you can tell, I don’t quite know how custom UVs work -_-. Thanks so much for your help!

My next issue is that the sphere mask is centered at the bottom center of the billboard. I would like to either place it at the billboard’s center, or shift the billboard down by half its height. Does anyone know how I can do that?

Thanks! I tried shifting it along the z-axis by the half-width of the billboard. Now the full sphere shows up, but only if I’m looking at it straight on (from the same height). If I change the angle from above/below that I view the billboard, the sphere shrinks. I think this is because the billboard is still pivoting around its bottom center, while the sphere mask just floats (0,0,half-width) above the pivot point in world space. Here are some images to better explain what I’m getting:



Do you know how I could fix this? I think I either need to have the sphere mask follow the center of the billboard, or change the pivot point of the billboard.

And again, thanks so much for your help!