I am currently working on an ocean surface and decided that I compute the vertex displacement on the Compute Shader (so that I can recall the information if needed) and at the same time send the displacement on my Material Shader and render my mesh visually accordingly.
So the mesh gets initialized with my triangle calculations and the vertex arrangement set up at the beginning.
On my Material Shader I call the SV_VertexID to select my vertex position from my StructureBuffer that holds the vertices.
Each update I calculate the vertex displacement and store them in the StructureBuffer which holds the vertices.
Now since I calculate each update my new vertex positions, my normals are obviously always different. I have not much experience with the whole normals and lightning stuff. And for performance reasons I wanted to calculate the normals on the vertex shader.
What I used above is called “central differences” since I used both the right and left neighbor. On the edges, you could use so called forward and backward differences, which uses the center vertex and either the left or right neighbor. Assuming your grid is at least 2 x 2 vertices large, you will always have either a left or right neighbor.