Ripples

For two new projects, I am working with simulating water.

Basically, the water is simulated by tesselating an image into smaller fragments, and then adjusting texture coordinates accordingly. A ripple is created with a center, and texture coordinates are then adjusted in an expanding radius around this center.

How the formula is implemented, makes the ripple simulate various materials. If the center continues to bounce undampened up and down, the material will look like a rubber sheet. The quicker the center is dampened, the lower the viscosity will seem.

A demo project for iPhone, featuring the basics of this, can be found here. If you find it useful, let me know, and I will provide updates.

https://github.com/Birkemose/rippleDemo

.

This is of course very basic, so there is plenty of room for improvements.

The demo project scans the entire surface for each ripple. Only vertices inside an ongoing ripple should be scanned. This reduces the number of calculations dramatically. Next, I have added vertex lighting to make the ripples easier to see, and to emphasize multiple ripples. This makes vortexes when swirling a finger, much more distinct.

Finally, I added caustics also using vertex lighting, and subtle vertex distortion. Both caustics and distortions are dynamic, and it is easy to see how the water settles, after having been stirred.

It still needs some tweaking, and final touches will be reflection highlights, and impurities in water ( small air bubbles etc )

About these ads

7 Responses to “Ripples”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: