UE 5.3 WorldPositionOffest not working properly?

I have a basic material to calculate the WPO based on the pixel distance.X from the camera.

But it seems to only work on the one side, if the pixelPos.X > cameraPos.X.
If the pixelPos.X < cameraPos.X, then there is no offset at all…

???

Power node, it squares everything :slight_smile:

So, for example, for the cameraPos.X = 0 and pixelPos.X = 2, the offset = 2^2 = 4.
For the camera Pos.X = 0 and pixelPos.X = -2, the offset = (-2)^2 = 4 (is expected to be).
So the plane should be bent on the left and the right side of the X-axis, but it isn’t.
Apparently, for the pixels positions < camera positions the offset is 0.
Why is that?

1 Like

But is the camera at 0 here?

Would a distance node work better there? ( instead of subtraction ).

1 Like

yes, Distance(AWP, CP) gives you that equidistant, circular boundary you would expect, otherwise other maths can be skewed in their result.

Run your distance gradients on CustomUVs.

1 Like

Interestingly, if I use the “Sign” node in the material graph, then everything works as expected.



:upside_down_face:

1 Like

Oh, where did that go? :smiley:

I’ve found on a number of occasions that ‘distance’ works where a subtract should have…

:slight_smile: undeleted the post

Yes, I have NO idea why that works, did you try distance?

No, I haven’t.
But using the sign node essentially gives me the distance to the pixel from the camera along X-axis and it is always a positive value and this solves the problem.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.