Circular Gerstner waves have no concentric movement

I successfully implemented the equations from GPU Gems article for Gerstner waves.
Now I want to have the simple directional waves replaced by circular waves that concentrically emerge from a point.
From the GPU Gems article as well as a paper “Real-Time Rendering of Procedurally Generated Planets” by Florian Michelic, this should be possible by simply replacing the direction by the normalized vector between vertex position minus wave center position.

For testing, I do it in my material function by having a circular parameter to lerp between wave direction and wavecenter version, so I can be sure, that rest of the code is identical.

The result looks bad, as on the left image below: waves are strangely moving around, no concentic movement at all. The simple direction wave works fine.

I did a visualization of my direction vectors using the following shader code instead:

Result of this looks good to me:


I’m a little bit lost. I found this thread: [][5] - but it just confirms, that I seem to do it correctly.

I feel somewhat lost at the moment not having any idea how to proceed and being too blind to see the mistake I’m doing…

Nobody having any idea, what might be going wrong here?

Here’s a video of the strange waves movement…


Thanks for any hints.

Hi, buddy! I was having the exact same problem as you do and I’ve discovered the solution.
When you do the dot product between the direction and the position, you shouldn’t use the world position.
Instead, use the difference between the world position and the collision center.
Technically you’re considering the collision center the origin of the coordinate system you’re computing the waves in and by subtracting you’re translating every point in this system. Then, the formulas from GPU Gems work like a charm.
It should look something like this in code:
vec3 diff = world_position - collision_center;
vec3 dir = -normalize(diff);
float gernst_coeff = w * dot(dir, diff) + time * phi;
Hope it’s not too late!

You are welcome! Glad it helped!

Hi, Vladislav, great! Now it works like charm, just had to move one single node connection and it solved the problem. Thank you so much.