I am making a buoyancy mechanic for my water which uses a shader graph to create waves and noise for the y-value. The waterplane consists of many tiled plane-objects with the same material. I need to get the y world coordinate of the vertices on the plane to calculate the depth and buoyancy. Is it even possible to do this via the shader graph?
I am using Unity 2020.2.2f1
Any advice appreciated!
I’m also not very experienced in shader graphing.
It’s impossible to get the vertex position after it has been modified by a vertex shader as this happens on the GPU every frame just before rasterisation. At that point, no information flows back from the GPU to the CPU. However, you can perform the same calculations that your shader graph does in a C# script to reproduce the same vertex position separately. You can view the code used for the gradient noise node in the shader graph documentation: Gradient Noise Node