Shader to blend layers based on world normal

Hello,

I’m hoping someone might be able to help us out with a shader query. We’re using HDRP and Unity 2021.2.4f1.

What we’re looking for is the ability to blend in a second texture layer based on the world-space normal. A typical usage example would be to apply a sand texture on upwards-facing surfaces of a rock material.

At the moment we are using the LitTessellation shader, and baking the sand and rock into one texture. This achieves the visual result that we want, but we can only use the rock objects in a fixed orientation. Ideally we would be able to rotate the rocks freely, and have the shader apply the sand texture on the top surfaces.

The LayeredLitTessellation shader looks similar to what we want in terms of blending layers, but is missing the option to blend based on world-space normal.

Is there an existing shader that can give us this functionality? Or could I modify the LayerdLitTessellation shader to achieve this? I had a look at the source code, and it’s daunting to say the least (files including files including files and so on).

Alternatively, is there a Shader Graph alternative to the LitTessellation shader that someone can point me towards? That would certainly be easier to tinker with.

Many thanks,
Tom

You can easily do this sort of thing with shader graph.

Slight correction to my original post - the props we want to rotate are based on the Lit shader and not the Lit Tessellation shader, which makes things way simpler. Shader Graph certainly looks like the right tool for the job.

Thanks!