WebGPU OCEAN AND PROCEDURAL SKY SYSTEM

This was a fun one! I got the chance to create an Ocean and Procedural sky system with volumetric clouds and buoyancy mixed into the equation!

The sky isn't a photo. It's calculated live on the GPU from a physical model of the atmosphere, based on Sébastien Hillaire's 2020 method: air molecules, haze and ozone scatter sunlight. As the day and night cycle moves the sun, the sky goes from a white noon to red sunsets, and then to a night sky with stars, the Milky Way, a moon and the odd meteor.

Clouds are real 3D volumes, not painted layers. The engine traces rays through low stratocumulus decks, cumulus and tall storm towers that a weather map places. Wind moves them, and they form, grow and fade over time. The sun lights them, so they redden at dusk, and they cast shadows on the ground below. On a full-size globe the same clouds wrap around the planet without seams.

The ocean is built the same way. Three layers of simulated waves are stacked: long swell from distant storms, the main wind-driven sea, and fine chop. Foam appears where wave crests actually fold and break, then drifts and fades instead of being a fixed texture. Near the coast, waves bend, grow steeper and break against the real terrain. Light enters the water realistically, so colour shifts from turquoise in the shallows to deep blue as red light is absorbed, and you can dive below the surface and look back up through it. Floating objects bob on the same waves you see.

Everything shares one sky, so changing the time of day, the weather or the cloud cover changes the lighting, reflections, fog and water colour of the whole scene together.

Foam forming and breaking

Foam isn't painted on. It appears wherever the simulated wave crests actually fold over and break, then drifts with the water and slowly fades. Three layers of waves are stacked to make the surface: long swell from distant storms, the main wind-driven sea, and fine chop.

Ships riding the waves

The ships float on the same waves you see, with no separate fake water for physics. Sample points spread across each hull feel the water push up on them, so a ship pitches and rolls on its own as swells pass under it.

From above to below the water

The camera crosses the surface without a cut. Above, light bends into the water and colour fades with depth as red light is absorbed first. Below, the surface becomes a shimmering mirror, with a bright window overhead where the sun breaks into glittering pieces.

Sunset into night

The sky is calculated live from how sunlight scatters through the air, so every sunset is the real result of the sun's angle, not a photo. As the sun goes down, the sky reddens, the light fades, and the stars and moon come out.

The night sky

The stars are matched to the brightness and colours of the real night sky. The Milky Way follows the real galactic plane, with dust lanes and a bright core. Stars twinkle more near the horizon, and shooting stars streak across, including named meteor showers.

Clouds from below

These are real 3D clouds, not a flat backdrop. Wind carries them, and they form, grow and fade over time. Their dense cores and bases shade themselves darker, they cast shadows on the ground, and they take on the sunset's colour.

Clouds from above

Fly over the cloud deck and the same 3D clouds are lit from above, with low layers, puffy cumulus and tall storm towers set by a weather map. They reach out to the horizon about 80 km away, and on a full-size globe they wrap around the whole planet.