Cloudscape WebGL — Volumetric Sky Raymarching
About This Simulation
Cloudscape renders a soft, sun-lit sky entirely in real time on your GPU with a GLSL fragment shader. Rather than drawing solid cloud shapes, a ray is cast from just below a horizontal cloud layer and stepped through it in a modest 28 samples, accumulating density from a hash-based fractal noise field (FBM) at each point — the same kind of layered, self-similar randomness that gives real cloud structure its soft big billows with wispy detail on top. Each sample is nudged sideways by a slow time offset so the whole layer drifts, while a second cheap noise lookup gently domain-warps the coordinates so the clouds fold and morph rather than sliding like a scrolling texture. At every dense point, one extra density sample toward the sun approximates self-shadowing, so cloud tops catch warm light while their undersides fall into cool shadow. A single Time of Day slider blends smoothly between three hand-tuned sky palettes — dawn, day and dusk — and your mouse (or phone tilt) drives a gentle parallax offset in the camera ray, so the whole scene shifts subtly with your perspective, like watching clouds drift while lying on your back.
Technique
Volumetric Raymarch
Noise
Hash-Based FBM
Lighting
Sun Self-Shadowing
Interaction
Mouse & Gyro Parallax
Frequently Asked Questions
What is volumetric cloud raymarching?
Volumetric raymarching casts a ray from the camera through a region of space that can hold varying amounts of "stuff" — in this case a hazy horizontal slab of sky — and samples density at several points along that ray. Instead of hitting a hard surface like a rock or wall, the ray gradually gathers colour and opacity as it passes through cloud, building up a soft, semi-transparent look rather than a solid one.
How many march steps does this scene use, and why not more?
This shader takes 28 steps through the cloud slab per pixel. Full volumetric cloud renderers in film and games often take hundreds of steps with multiple scattering bounces, which is far too costly for a real-time browser tab. Twenty-eight steps with a single self-shadowing sample is a deliberately lighter approximation, tuned to stay smooth on ordinary laptops and phones while still reading convincingly as billowing cloud.
What is FBM noise and why does it look like clouds?
FBM (fractal Brownian motion) layers several octaves of value noise at increasing frequency and decreasing strength, the same way real cloud structure has large soft billows with smaller wispy detail riding on top. Summing five octaves of hash-based noise produces exactly that layered, organic softness without needing any texture images or 3D cloud data.
How do the clouds drift and morph over time?
Each march sample's position is advected sideways by a slow time-based offset before the noise is evaluated, which reads as the whole cloud layer drifting. On top of that, a cheap secondary noise lookup domain-warps the sampling coordinates so the cloud shapes themselves slowly fold and morph rather than just sliding rigidly, avoiding the repetitive look of a plain scrolling texture.
How does the sun-lighting and self-shadowing work?
At every point where cloud density is found, the shader takes one extra density sample slightly offset toward the sun direction. Denser cloud in that direction means less light reaches the point, so it is shaded darker and cooler; thinner cloud toward the sun lets more warm light through. It is a single cheap sample rather than a full secondary light march, but it is enough to give the clouds believable sunlit tops and shadowed undersides.
What does the Time of Day slider control?
The Time of Day slider blends between three hand-authored sky colour presets — a warm pink-orange dawn, a bright blue day, and a deep orange-purple dusk — using smooth interpolation. At 0 you get dawn, at 0.5 a clear midday sky, at 1 a dusk glow, with every position between blending continuously rather than snapping between the three.
How does the mouse parallax effect work?
Your pointer position is converted to a normalised value from -1 to 1 relative to the canvas centre, then smoothed a little further each frame so it eases toward wherever the pointer currently is instead of jumping there instantly. That smoothed value nudges the camera's ray origin and direction by a small amount, so the cloud layer appears to shift very gently with your perspective, like looking through a window as you move your head.
Does the parallax work on my phone?
Yes. Touch-drag on the canvas feeds the same parallax value as mouse movement. Where the device exposes gyroscope tilt data, gentle phone tilts drive the parallax instead, so lying back and slowly tilting the phone shifts the cloud view — no special setup is needed on most Android browsers, and iOS shows a small optional Motion button since Apple requires a tap before granting tilt access.
Why is this scene brighter than the other WebGL simulations?
The other scenes on this site (aurora, nebula, crystal cave, bioluminescent ocean) are all set at night for a moody, low-light atmosphere. Cloudscape is intentionally a daytime-leaning scene by default — sky and cloud undersides are naturally brighter than a night sky — though the Time of Day slider lets you dial it back toward a softer dawn or dusk palette if you prefer less brightness.
Does the Cloudscape simulation work offline?
Yes. ASMR Sanctuary is a Progressive Web App. After your first visit the Service Worker caches this page and its shader code, so Cloudscape keeps running fully offline with no internet connection required.