Hello all,

I have been implementing Gerstner Waves in my engine and i have encontered a problem that as kept me from moving on :D.

The positions are being computed correctly but the computed normals (using equation 12 in this paper https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch01.html) do not seem to be correctly interpolating in the fragment shader.

Here is the code:

```
// Normal
for(int i = 0; i < nGerstnerWaves; i++)
{
float WA = waveFrequency[i] * waveAmplitude[i];
float waveNormal = waveFrequency[i] * dot(waveDirection[i], totalPosition.xz) + (wavePhaseConstant[i] * timeStep);
totalNormal.x += waveDirection[i].x * WA * cos(waveNormal);
totalNormal.y += waveCrest[i] * WA * sin(waveNormal);
totalNormal.z += waveDirection[i].y * WA * cos(waveNormal);
}
totalNormal.x = -totalNormal.x;
totalNormal.y = 1 - totalNormal.y;
totalNormal.z = -totalNormal.z;
totalNormal = normalize(totalNormal);
```

And the Wave parameters are these (just one wave for now)

```
{"amplitude": 1.5, "direction": [1.0, 0.0], "steepness": 0.8, "speed": 0.9, "length": 10.0}
```

And heres two quick videos of the issue:

https://youtu.be/AuZryRo6jdo

https://youtu.be/U03243xIgh4

Thanks in advance,

AndrĂ©