Hi,
I'm making a small 3d waves demo computing the waves based on the distance of the vertex from the camera.
Acoording to this older post to compute the Normal I should compute the partial derivatives of the function I'm using for the waves... I tried the example they're using (a 2d wave) and it works just fine...
The formula I'm using is quite simple:
f(x,z) = amplitude * Sin( (sqrt( x^2 + z^2) + fase) * frequency );
thus the gradient vector would be <fx, fy, fz> which according to some math references it should be the normal of the given surface at any point by itself.
however, if I normalize it and use it in my vertex shader, the lighting doesn't look right...
Am I not doing it right?.... am I missing something?
Thanks