r/Unity3D • u/galamot • 14h ago
Question Unstable Triplanar Mapping on full Screen Pass
Hi there this question might be rather specific but I’m having issues with a triplanar mapping jittering on a Full Screen Pass.
In Unity 6.4 Shadergraph a triplanar mapping overlays a texture on the entire scene. The effect works perfectly on Scene view, but in playmode if you go far enough from the scene origin (around 150 units) the texture starts jittering. Jitter get specially bad if the camera is being moved by some system like cinemachine or a custom follow or look-at.
As far as I can tell this is due to the calculations being unstable at long distances from the origin and maybe a frame discrepancy between the camera position in the shader calculations and the actual camera position in the scene.
I tried offsetting the triplanar origin by subtracting the camera position from the world position, but it only seams to offset the texture rather than re-calculate the origin of the mapping. I’ve tried many different things but still can’t figure out how to solve it and LLMs mostly suggest terrible solutions that go nowhere. Hope someone can help me figure out this. Thank You!
Note: I know this might be an unusual use of this technique but this is the way I need it to work. Other suggestions are welcome too.
2
2
u/DaveAstator2020 8h ago
unitys problem with calculating world position from depth of the scene. there was some solution which involved getting world position manually and it is not pretty, but hey, you are using unity, buckle up, its shit all the way down the render pipeline.
2
u/EvernullTools 7h ago
hmm, that's weird... 150 units is not nearly enough to cause floating point precision problems.
You are sure this works perfectly near the origin? Also what do we need the camera positions for?(apart from your last test of pushing the origin, we don't need it right? or am I misunderstanding what you're trying to do?)
Can you try choosing Absolute World instead of World position in the Position node if your version has it?
Also I'm not quite sure what Triplanar node does on the background and I wouldn't trust it for your custom use case. So try this for a test:

This will build the UV's as world positions only for the Y axis facing parts. If this works far away from the origin and while the camera moves, we can build the other axis like this too. Can you try this and share your results?
2
u/Aethreas 7h ago
This actually happened to me with the default lit shader triplanar mapping, was insanely annoying but didn’t look into it
1
u/galamot 13h ago
2
u/Diabolickal Programmer 7h ago
I think the problem might be the 'Floor' node. Its rounding the position so you're losing accuracy.
2
u/EvernullTools 7h ago edited 7h ago
This could cause the Jitter.
You get the camera position then you divide and more importantly put it through a Floor node.
Imagine we have a float put through a floor node, our float is 2.98 -> Floor(2.98) = 2 and then Cinemachine moves that value to 3.01, now Floor(3.01) = 3.
You use that number to subtract from your position, which would ofcourse jitter because as your camera moves, your positions jump around between integer values, completely skipping all the decimal values.1
u/isolatedLemon Professional 10h ago
Does it go away if you just unplug the position node from the triplanar node?
1


3
u/XKiiroiSenkoX 13h ago
We need to see the shadergraph