Sign in to follow this  
tnutty

Simulating water

Recommended Posts

I do not need a very good one now , just one thats working. can you help me? What I have so far is a basic 3d grid, sort of like a heightfield grid with height being 0. I want to try to create a water ripple. [Edited by - tnutty on July 22, 2009 9:46:47 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by tnutty
How would you create a water on a terrian.


This is something I made a while ago: http://kindjie.googlepages.com/home#fishtale

The formulas to displace the points are on the page, along with a link to the original paper and some (slow) C++ code. Check the video first to see if it's what you're looking for.

Good luck!

Share this post


Link to post
Share on other sites
To make water anywhere you just draw geometry over the terrain. You could imagine a heightmap and a plane that intersects it. Put a blue texture on the plane and you've got water on terrain. Obviously you'll want to use fancy textures and rendering techniques to make the water look more interesting. But really it's just planar geometry intersecting the world geometry.

If you have a modeling program such as 3d studio it's very easy to experiment with.

Also the plane doesnt extend for ever, but only extends far enough to intersect the terrain geometry. Then it can stop. You do this so that you can have lakes up in the mountains and stuff and not have a gigantic water plane extending out to the horizon, out of your mountains.

Share this post


Link to post
Share on other sites
this isnt a complete solution but should hopefully get you started:

to start your ripple, set a DISTANCE variable to 0.

every tick of your function do the following:

1) loop through all vertices in your water grid, calculate their 2d distance from the center of the pond (ie ignore height!). Set the height of each vertex to be:

HEIGHT = sin(DISTANCE/WAVE_WIDTH)*WAVE_HEIGHT;

2) make distance larger each tick:

DISTANCE += WAVE_SPEED;

that will make a bunch of ripples that emanate from the center of the pond and go outwards.

Like i said it's not a complete solution but it should be a good start!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this