Recently I have been unsuccessfully trying to implement Tessendorf's deep ocean water.
When it comes to rendering, I have some huge peaks in the center of the grid around (0,0), and then almost nothing at the edges. I've traced this back to the philips function which looks exactly the same as H0 and any dynamic heightmap created. There is a bit of noise added in between.
I'm at an ends to what is causing this and i know i get nothing like any of the other implementations out there. Chengine, Roam Alaska.
float CWater::philipsSpectrum(float fX, float fY)
double fLength = fX*fX + fY*fY;
if(fLength == 0)
float scale = sqrt(fLength);
fX /= scale;
fY /= scale;
float v1 = fLength*SQR(fWaveLength);
float v2 = fLength*SQR(fWaveLength);
//Second exponential function destroys small waves
double out = fWaveHeight * expf((-1.0f / v2) - v1);
out *= powf(fX * vWindDir.x + fY * vWindDir.y, fDirDependence)
(fX,fY) = ((x,y) - gridSize/2)*2*PI/gridSize;
H0(x,y) = 1/sqrt(2) * philipsSpectrum(fX, fY);
fWaveLength = (L,l) = 1000, 1
fWaveHeight = 30;
fDirDependence = 4
If you have any advice it would be great, if you need me to post some other stuff that is fine too.