View Full Version : sea waving
01-07-2003, 10:45 AM
I want to make a very simple pool(white colour)with blue water in the pool but i want the water to seem like waving.How can i do it using a stack? Can I have the basic part of the code doing that?
01-08-2003, 12:39 AM
Check out the wave.c demo in the GLFW (http://hem.passagen.se/opengl/glfw/) source code distribution. It might be of some help (?)
01-08-2003, 02:03 AM
The simplest but something that can give good results is to attach 2 values to every control point (assuming you have say NxN mesh of water with (N+1)*(N+1) control points):
-height (0 by default - no waves)
-velocity (0 by default - no movement)
Now every point will tend to achieve height=0.
-If it has height < 0 it will increase it's velocity
-If it has height > 0 it will decrease it's velocity
In both cases you increase height by velocity (when velocity is negative you'll decrease however).
The thing that will make your water have waves moving from one to another side of the water mesh is to additionally increase height of every control point by say 25% of velocity of every neighbourous control points (most of them have 4 neighbours).
This way you'll see that every control points has influence on every other control point.
To make a water splash it's enough to give to one of the control points a negative height.
You add some time-independence to your simulation and it should look pretty nice.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.