Monthly Archives: January 2012

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 )