Unreal WorldPositionOffset + Opacity Mask

So this is a bit of headscratcher for me…


Final image

What you are seeing here is the result of using the same sphere mask, based on material world position node excluding material offset, feeding into a alpha mask and an offset.

The offset pulls the pixels which would be clipped outside of the sphere mask.
Now I would expect them to just clip out as they would without the offset, the values they use are correct, the sphere mask is not influenced by the vertex offset.

I’m feeding sphere mask result into emissive

What I am observing however is some kind of difference between “wether the pixel should be rendered or not” and “wether the pixel should write into the depth buffer”

Depth buffer visualisation
As you can see, the pixels which are offset outside of the spheremask range get to write their depth into the buffer, while some of the pixels being pulled into it cannot.

As I say, this is a bit of a headscratcher to me.
I fail to see how writing a white pixel in the back buffer in the right place would be any different from writing depth in the depth buffer in the correct place.

Any help would be appreciated as I seem to be completely stuck :smiley:

I’m running into a similar head scratcher, which lead me to this post.

I’m using a masked material.
If the material has an Opacity Mask of 0, the Actor is invisible and still has a mesh wireframe.
If the same material has an World Position Offset of anything other than 0 it will no longer have a wireframe.

In my project, I noticed this because I am using an opacity mask to remove objects outside of a sphere. Objects with any amount of World Position Offset have their wireframes culled when they’re not in the sphere, which for me is great, but I don’t know why this is happening :expressionless: any items that don’t have the WPO are still rendered even though they are fully masked out (which is more what I would expect)

The tree in top right background (wireframe view) has no WPO and has a rendered wireframe despite being masked (per expectation), the tree in the sphere is half rendered and only has part of it’s wireframe as it exits sphere.

Why is this?

I’m not quite sure if I understand entirely what you mean. One thing that I usually do if similar things happen to me: I subtract whatever I’m doing in the WPO from my AbsoluteWorldPosition.
For some reason it just sometimes doesn’t work correctly (even with 'Include WPO selected).
It’s annoying as you basically have to do all the logic twice in your example:


Result: