Why do I get more precision loss at negative Z values?

I have a WPO material and place it on a plane at 0,0,120000000, and one at 0,0,-120000000. The 120000000 plane has no jittering or apparent precision loss, while the negatively placed plane does. Why is this? Is the exposed 0,0,0 world position in the engine not actually 0,0,0?

Hi, @seekervoo, I think I may have found your answer.

Unreal in 5.0 switched to using Large World Coordinates instead of vectors for position values. I originally thought this was just limited to Niagara, but apparently no- this was implemented in materials as well.

The LWC system uses a set of single-precision floats instead of doubles to save on computing power, and it does this by basically creating a 3d grid around the world and assigning each grid a number. Then, within that grid, the location is stored as 3 floats with an origin point at the grid section’s origin. This allows for easy and quick lookup later of large world coordinates.

Now, where this effects you is that I believe by default materials use the old coordinate system. Given that a negative sign is another bit, you’re probably reaching the limit of what’s precisely registerable. To fix this, you need to change your World Position nodes from Absolute World Position to Camera Relative World Position.

You can read more about LWCs and its use in materials here.

Let me know if that helps!

Thank you its not jittering anymore. So is it convention to always use camera relative position and not absolute world position? Are there tradeoffs for both? Like when would you use absolute world position vs camera position?

Great to hear!

I would definitely only use camera relative if you know you need it- i.e. if you know this asset will exist probably >1m units away from world center just to be safe. Using Large World Coordinates in materials is more expensive, since the calculations needed in HLSL add more complexity.

That being said, this is a great example as to why you should always make sure your scene is centered around the world origin. LWCs were introduced to cheaply expand the size limit of open worlds, but that does not mean its systems should be used unless they have to be.

1 Like