Raymarched cumulus with silver linings, light shafts and drifting shadows.
Each pixel's view ray marches through a layer of cloud built from tileable 3D noise: value noise blended with Worley cells into billowy shapes, cut by a coverage map and a height profile, then eroded by finer Worley noise so bases go wispy and tops go cauliflower. At every step inside a cloud, five growing steps toward the sun measure how much cloud is in the way (Beer-Lambert), and a two-lobe Henyey-Greenstein phase, a sum of three ever softer scattering octaves standing in for multiple scattering, and a powder term shape the light. The camera stands still, so each frame marches one pixel in every 3x3 block and reprojects the rest along the wind using each pixel's cloud depth. Light shafts come from a radial blur of the sun's visibility, and cloud shadows sweep across the fields below a lone acacia.
Try it. Drag the sky to move the sun (try putting it just behind a cloud). Use the sliders to go from fair weather to a lightning storm and to change the wind. Arrow keys nudge the sun, and R resets.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a volumetric cloud renderer with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window. Render into a small offscreen canvas (about 160 by 100 pixels) with ImageData, then drawImage it scaled up with smoothing on.
- Write a small 3D value noise function and sum three octaves of it (fbm).
- Put the camera on the ground looking slightly up. For each pixel, intersect the view ray with a flat cloud layer between 1.5 and 3.5 km, and march about 32 steps through it.
- Cloud density at a point is fbm(point) minus a coverage threshold, clamped at zero, and faded out near the top and bottom of the layer.
- Accumulate with Beer-Lambert: at each step, transmittance *= exp(-density * stepLength * sigma), and add the light at that point times the amount absorbed. Stop early when transmittance is nearly zero.
- For the light, take four short steps toward the sun, sum the density, and use exp(-sum) as the sunlight that reaches the point, plus a little blue sky light.
- Blend the cloud color over a simple sky gradient.
Once that works, make it beautiful:
- Multiply the sunlight by a Henyey-Greenstein phase function (g around 0.7) so clouds near the sun get bright silver linings.
- Precompute the noise into a small tileable 3D array and sample it with trilinear interpolation so it runs fast enough to raise the resolution.
- Let the pointer drag the sun, warm its color as it gets low, and slide the noise with time so the clouds drift.
- Add a coverage slider that goes from a few puffs to a heavy sky.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as Worley noise for puffier shapes, cloud shadows on the ground, or light shafts.