Getting proper normals on a grid mesh with vertex offsets?

Hey all, newbie here and I have a quick question for anyone interested in aiding an answer. I am working on a Gerstner wave vertex shader based off this paper:

http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html

I am trying to keep it simple at first by just dealing with vertex offsets and normals of one wave, not summed ones. It looks as though I have all of the vertex position offsets working as well as the computations for the normals, binormals, and tangent vectors (equations 9-12).

The part I am a little stuck on is getting my subdivided grid to display the proper normal direction based on the wave.Currently, my code just offsets the vertex positions and keeps the normals all pointing in the up-vector (0,0,1) which prevents proper lighting. Has anyone here worked on this type of shader and can possibly help point me towards a proper solution? I think the problem possibly has to do with world transformations and some other math but again, am a little lost after this point.

cheers
 
Back
Top