Search Unity

Mobile water waves (mesh deformation)

Discussion in 'Shaders' started by Gooren, Apr 29, 2017.

  1. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi,

    I want to add waves to my 3D mobile game water system. The game is bottlenecked by the GPU already, so I was thinking that it might be a good idea to do the mesh deformation on the CPU by scripting it. But I have many questions about all this.

    1) When you do the mesh deformation in the vertex shader, does it actually modify the mesh instance referenced from the 'Mesh Filter' component?
    2) How much (if any) GPU overhead does scripting the mesh deformation and then feeding the modified mesh back to GPU generate? I just want to make sure that it makes sense moving the deformation from GPU to CPU.
    3) If doing the mesh deformation in shader - how can I control whether it is per pixel or per vertex?

    As you can see, I am quite confused here.
    Answering these questions will be a big help for me.

    Thanks,
    Stepan
     
    Last edited: Apr 29, 2017