I have a unreal 5.4 project which I believe has lwc integrated by default.
When i go far from the world origin, I get precision issues with shaders that rely on world position.
Has anyone else had this issue?
if you are using World Position to drive World Position Offset in your material then you could try increasing the “Max World Position Offset” parameter inside of the problematic material.
Also LWC is capped at 21km by default anything above that range will start to have problems.
You can override the settings with c++.
The documentation has some information regarding the process
Look at the fragment Experimenting with Large Worlds
For a space game the setting UE_USE_UE4_WORLD_MAX=0
might be an option. You can also think if scaling down everything by half might give you a larger world to play in.
I see. I experience issues at around -15km on the x axis, so dont think increasing the bounds will help.
However I have fixed my shader issue now! The world position node outputs perfect world position, I was doing some additional things to it which resulted in values twice the size of of the actual world position, and unreal had precision issues only in that case I think.
I have however noticed another issue elsewhere in my shaders. The boxmask-3D node. When you are at -15km, it becomes stepped/artefacted at the falloff zone of the box mask.
I have also noticed another issue at -15km, my directional light’s cascade shadows sometimes disappear, depending on the angle of the directional light.
I would try increasing the world bounds, however that requires modifying the engine source, does it not?
your world is too big. you’re hitting the numerical precision of a 32-bit floating point value. changing it to 64-bit will half the cpu performance and tank your TeraFlops with a theoretic 1:64 ratio on nvivia gpus.
the smarter way would be to subtract the world origin in a chunk like fashion. so you have a local coordinate system with proper precision for gpu math in camera. are you using world partition? i don’t even know if it does that, but it should do exactly that.
I thought UE5 is 64 bit by default. I noticed they changed many things to use double instead of float format in ue5.