Hi, with Shader Graph I am working on a URP terrain shader that will be used in PC (and maybe Android) VR apps, and I plan to implement different mapping options such as Triplanar and UV mapping.
For the triplanar mapping, I suspect having it in Object space costs less than using Absolute world space as input position, but I wish to know what’s the real deal, if there is any, between the two options in terms of shader optimisation. It’s also important for me to know because the choice will impact my workflow.
By default lit Shader Graph shaders already always have the world space position, as it’s needed for lighting. It does not have the object space position, so it must calculate it from the world space position if you use it in the node graph. It’s not much more expensive, as it’s only an extra matrix multiply, but it is slower.
Plus if you’re using normal maps, the Triplanar node is totally broken when using object space inputs. It always assumes you’re passing in a world space position and normals. I posted a sub graph layout that handles object space triplaner normal mapping here:
I’ve been using a custom triplanar node built 99% on your solution, later on however i noticed i could simply use the Triplanar node in Default mode and then use that to sample a normal map and then pass it through a Normal Unpack node set to tangent space. Is there some reason i shouldnt do that what do you think?
edit: never tested with a complex object, turns out the tangents dont work quite right in motion when done that way.