Back

Wave Heightfield (Clickable)

This solves the damped two-dimensional wave equation, $\frac{\partial^2 u}{\partial t^2} = c^2 \left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}\right) - \gamma \frac{\partial u}{\partial t}$, on a 256x256 grid whose edges are clamped to zero (Dirichlet walls, like a drum skin pinned at its rim). Click anywhere on the shaded surface to seed a Gaussian bump of height $A$ and width $\sigma$; it splits into a ring that travels outward at the wave speed $c$, reflects off the four walls, and passes through earlier ripples, adding where crests meet and cancelling where a crest meets a trough (linear superposition). The $\gamma$ slider adds damping, so the energy bleeds away and the surface settles flat; with $\gamma = 0$ the total energy is essentially conserved (the readout tracks it). Raising $c$ makes the rings travel faster and forces a smaller stable time step internally (the explicit scheme is only stable below the Courant limit). The surface is a real Blinn-Phong-lit 3D heightfield, not a flat colour map: drag to orbit, scroll to zoom, and the readout shows the energy, the absorbed-energy fraction, the click count and FPS.

Figure 1. Shaded heightfield of the displacement u(x,y,t)u(x,y,t) for the damped 2D wave equation, with click-seeded Gaussian impulses reflecting off Dirichlet walls and interfering. Method: explicit finite-difference time stepping on a 256x256 grid, Blinn-Phong shaded surface.

WHAT TO TRY

  • Vary each control and watch the rail readouts respond.
  • Compare the diagnostic plot against the live scene.