# How do i achieve circular Gerstner waves?

**URL:** <https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855>\
**Category:** Rendering\
**Tags:** Water, wave, unreal-engine, shader, question\
**Created:** [April 25, 2019, 3:35pm UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855 "2019-04-25T15:35:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DomSewell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DomSewell](https://forums.unrealengine.com/u/DomSewell)\
**Post date:** [April 25, 2019, 3:35pm UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855/1 "2019-04-25T15:35:29Z")

</div>

Hi all,

I’ve recently put together a Gerstner shader interpreting the equations supplied on the nvidia GPU gems page found here [Chapter 1. Effective Water Simulation from Physical Models](https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch01.html)

I was able to get directional waves woring perfectly fine however when implementing the circular waves equation i get undesired square shapes moving to the origin rather than a full circle

 ![275206-gerstner-function.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/0/1/5014ac66c8e47c5c875b539507555e338357509e.jpeg)

 ![275207-gerstnerissquare.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/3/3/833b5c81dc1676236889b035886e2d7f642892f1.jpeg)

How do i achieve the circular pattern displayed in the diagram on nvidias page?

---

<div class="post-metadata">

**Author:** ![bldy\_ch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bldy\_ch](https://forums.unrealengine.com/u/bldy_ch)\
**Post date:** [April 25, 2019, 3:47pm UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855/2 "2019-04-25T15:47:57Z")

</div>

Hi

I think the formula on nvidias page is incomplete. In my opinion, what you see in the equation 11 is acutally supposed to what mathematicians call the 2-Norm and not the absolute. Instead of calculating the _abs_, square each component of the Vector, sum them up and then take the square root of that. Hope that solves your problem.

---

<div class="post-metadata">

**Author:** ![DomSewell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DomSewell](https://forums.unrealengine.com/u/DomSewell)\
**Post date:** [April 25, 2019, 7:20pm UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855/3 "2019-04-25T19:20:12Z")

</div>

Hi,

Thanks for the reply, I do however have a working Gerstner wave for my displacement using just equation 9 (i believe the equations afterwards are to calculate normals)

What im particularly interested in is how it provides the equation for circular waves slighty above equation 9 and instructs to replace “Di” with this new equation which is what i have done but am not achiving the desired result

---

<div class="post-metadata">

**Author:** ![Deathrey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Deathrey](https://forums.unrealengine.com/u/Deathrey)\
**Post date:** [April 25, 2019, 7:46pm UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855/4 "2019-04-25T19:46:44Z")

</div>

Remove division by absolute before normalizing direction vector.

---

<div class="post-metadata">

**Author:** ![bldy\_ch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bldy\_ch](https://forums.unrealengine.com/u/bldy_ch)\
**Post date:** [April 25, 2019, 9:16pm UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855/5 "2019-04-25T21:16:15Z")

</div>

I did not realize you had a normalizing function down there too. (See the comment below by Deathrey). You should be able to remove the division altogether, since it does nothing, it might even be the reason for the squares

Basically what might happen is: (x,y are positive)

abs((-x,y,0)) = x,y,0

And then your division maps:

(-x,y) → (-1,1), (x,y) → (1,1) etc

By dividing each component with its absolute value. This would explain where the issue comes from.

---

<div class="post-metadata">

**Author:** ![herb64](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@herb64](https://forums.unrealengine.com/u/herb64)\
**Post date:** [August 18, 2020, 6:50am UTC](https://forums.unrealengine.com/t/how-do-i-achieve-circular-gerstner-waves/447855/6 "2020-08-18T06:50:33Z")

</div>

Hi  
Did you get this up and running? I’m struggling with problems with circular Gerstner waves, just opened a new thread [here](https://answers.unrealengine.com/questions/978152/circular-gerstner-waves-have-no-concentric-movemen.html), because my problems look different from yours. Are your waves concentric or did you find these strange movements as well after removing that division by absolute?
