Skip to main content
Don't repeat tags in the title
Link
DMGregory
  • 140.8k
  • 23
  • 257
  • 401

Unity: Water shader vertex offset - how How to add mesh collider which updates with water wave vertex offset?

Source Link

Unity: Water shader vertex offset - how to add mesh collider which updates with vertex offset?

I have written a shader (in the new LWRP shader graph) which simulates an ocean with vertices which offset to create a moving "waves" effect.

I believe that in order to have objects "float" on my moving waves, I shall need to create a mesh collider which is a trigger (please correct me if I'm wrong) which updates with the moving vertices of the mesh as per direction from the shader.

How is such an effect possible? Am I taking the correct approach here? Please advise :)

Many thanks in advance!!

(the original model for the water is a plane which has been subdivided multiple times to provide suitable resolution for the vertices to be offset)

Ocean shader screenshot with wireframe to show vertex offset