Search code examples
unity-game-engineuv-mappingunity3d-shadersshader-graph

Global Tiling in HDRP Combined with Parallax Occlusion Makes Messed up UVS


I'm trying to make a custom shader with Shader Graph on HDRP. The intention is to automatically tile textures based on global position so I don't have to worry about remaking materials when I resize things etc. (I'm sure you can imagine the usefuleness of this). But when I do that, combined with the Parallax Occlusion Mapping node (built into HDRP) for height mapping the UVs get all messed up, and the height mapping doesn't even seem to work for some reason.

I thought that if I fed any source UVs into the Parallax Occlusion Mapping node that it would work just fine, but for some reason it doesn't in this case (it's especially obvious when zoomed far in that something is wrong with the UVs). I'm fairly new to shader graph so I'm not exactly sure how to resolve this issue. Let me know if you need anything else from me.

Here is the relevant shader graph nodes (not pictured is pretty much just mapping textures directly into the output node, if you think it might be relevant I can post those too)

enter image description here

Here is the zoomed out version of the scene (with some sample textures) without my global tiling activated (top) and with (bottom). As you can see the tiling works but the height disappears:

Top Bottom

And it gets worse if you zoom in (no tiling top, with tiling bottom):

Top2 Bottom2


Solution

  • You are missing to connect PixelDepthOffset to the corresponding entry in the Master node. It looks like it's shifting correctly the UV, but the rendering pipeline is not aware it should also change the depth pass accordingly.

    You can enable the depth offset in the options of your master node, as follows: Shader with DepthOffset connected