Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


How to calculate normals from gerstner waves


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 DavidM   Members   -  Reputation: 125

Like
0Likes
Like

Posted 15 October 2012 - 02:42 PM

Hi there,
I have read some threads here asking a similar question. But the examples are different, or more easy than this. I have tested first the most simple wave and I got the normal working properly.
For me this is the case:

float k=2.0*3.1416/L;
float3 w=sqrt(9.81*k)*t;
float theta =dot(K, wp) -w;
float2 XY=(K/k)* A * sin(theta );
float Z= A* cos (theta );
return float3(XY.x.x,XY.y, Z);

As explained in tessendorf, K is the wind vector and L is lambda.

So the question here would be how to derivate this and finally how to get the normal.

Thanks!

Sponsor:

#2 Bacterius   Crossbones+   -  Reputation: 9306

Like
0Likes
Like

Posted 15 October 2012 - 06:40 PM

Heya, it's been forever since I worked with Tessendorf waves but I recommend this website, it shows how to generate the waves along with the normals using the FFT, code included. Note there are two parts! Or if you are not using the FFT method, there is a - admittedly rather arcane - description of the normal for Gerstner waves in this GPU Gems article, have you looked at it?

If everything fails, you can always use good old finite difference approximation to evaluate the normal, which is a bit more expensive since you have to sample the wave multiple times, but at least is general-purpose.

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#3 DavidM   Members   -  Reputation: 125

Like
0Likes
Like

Posted 16 October 2012 - 04:16 AM

Heya, it's been forever since I worked with Tessendorf waves but I recommend this website, it shows how to generate the waves along with the normals using the FFT, code included. Note there are two parts! Or if you are not using the FFT method, there is a - admittedly rather arcane - description of the normal for Gerstner waves in this GPU Gems article, have you looked at it?

If everything fails, you can always use good old finite difference approximation to evaluate the normal, which is a bit more expensive since you have to sample the wave multiple times, but at least is general-purpose.


Thanks, but... im a beginner. I got the gpu gems example working right. That sample is a bit more easy. Mine has a difference, the (K/k) * wave, and the movement both in XY and Z, not just the vertical (z for me). Its just a math thing.

Edited by DavidM, 16 October 2012 - 04:17 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS