Jump to content
  • Advertisement
Sign in to follow this  
tnutty

Simulating water

This topic is 3346 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Draw a texture that has some repeating ripples and bind it to a quad. Adjust the UV coordinates over time to make the ripples move. Then set slight transparency so that the ground can be seen through the water and voila, you got some tacky water.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!