Using world space UVs with vertex displacement in shadergraph

I have a relatively straightforward ocean shader where I use two render textures for vertex displacement and tangent space normals. The displacement is for a large patch of ocean, which is infeasible to represent with a single plane mesh. My initial idea was to simply switch from mesh UVs to world space UVs, however I’ve ran into trouble regarding the fragment stage of the graph.

When I switch to world space UVs (Attached image), the tangent space normals become distorted. I also use the length of the displacement vector as a proxy for subsurf scattering on the fragment side, which also diverges in terms of appearance. The vertex displacement however remains identical. Additionally, if I plug the normals into the vertex normal input I get the expected result. (This is a no-go for my use-case.) Alternatively, unplugging the vertex displacement results in correct fragment output regardless of mesh / world space UVs.

So basically it seems I need to somehow account for the vertex displacement in the fragment stage, but I don’t know how to do this in shader graph. Any help would be greatly appreciated!

How does it look like?

It will be hard to help without rest of the graph :slight_smile:

Sorry about that, I’m quite new here. Here’s a simplified version of the rest of the graph that is enough to replicate the issue, as well as the visual output for both UV types. Basically everything I plug into the fragment block looks different when switching between the two:

It’s not extremely obvious, but there’s still a clear reduction in the normal quality using world space UVs. Also the faked “subsuf scattering” I’m using in the emission slot appears more bland, I don’t know how else to describe it other than it looks like there’s a problem mapping the textures onto the displaced surface correctly. Maybe it’s naive on my part but I thought if I can just replicate the standard mesh UVs from world pos, the output must be equivalent.

I can’t see much difference, but you mixed spaces a lot.

  1. You sample normal texture in default mode, not as normal texture
  2. Upper sampler outputs normals in tangent space, but for some reason you transform them from object to tangent again.