All Projects → m-ender → webgl-ripples

m-ender / webgl-ripples

Licence: MIT License
A physically realistic real-time simulation of (transversal) 2D waves in WebGL.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

WebGL Ripples

A physically realistic real-time simulation of (transversal) 2D waves in WebGL.

Check out the live demo!

Technical Details

The waves are simulated on a square grid in the form of a texture on the GPU. Each frame, the texture is updated based on the last two frames. Then this texture is used in a second pass to create a simple rendering (using surface normals for specular lighting).

bcTexture.png is loaded to provide "boundary conditions" (regions where the amplitude of the wave is always zero), by reading its alpha channel.

The simulation is done by solving the wave equation with a simple explicit finite-difference scheme of 2nd order.

New waves are created by writing a small sinusoidal ripple into the last two frames (the second one slightly larger than the first) before calculating the next frame.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].