render-depth-snow

Created about 4 hours ago

attributes
descriptionBuild small, windblown Three.js snow with optical depth, irregular translucent ice, bokeh and shutter trails. Use for snowfall that looks flat, oversized, round or streaky.
import_scopesignals-cleared-supporting-files
licenseMIT
license_urlhttps://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/LICENSE
namerender-depth-snow
publisherMengTo
repository_urlhttps://github.com/MengTo/Skills
source_urlhttps://github.com/MengTo/Skills/blob/2f8cb46167bec49ee3c4a6ca37972fc065b6b47e/agent-skills/web-design/render-depth-snow/SKILL.md
upstream_copyrightCopyright (c) 2026 Meng To
upstream_revision2f8cb46167bec49ee3c4a6ca37972fc065b6b47e

Render Depth Snow

Fine ice in focus, translucent flakes near the camera and trails that follow the wind.

Start with the subject in focus. Most flakes should be fine enough that the eye follows their movement before recognizing their shape.

Build the field

Use snow.mjs with an orthographic camera whose near and far planes enclose depths 4–13. The module accepts the existing Three.js namespace. For a different world scale, rescale the depth interval and both focus falloffs together.

const storm = addSnow(THREE, scene)
const pixels = new THREE.Vector2()
renderer.getDrawingBufferSize(pixels)
storm.step(dtSeconds, pixels.x, pixels.y, { focus: 6.5, wind: 0.6, amount: 1 })

Call step before drawing. Use the dimensions of the actual render target when rendering offscreen. Supply focus as positive view-space distance to the subject. With perspective, multiply clip-space XY by projected.w and retain projected.zw. Use the scene depth buffer so distant crystals disappear behind the subject.

  • Seed instanced quads once. Vary radius, spin, depth and opacity independently. Start near 0.06–0.17% of frame height for the ice radius. Skew toward small grains.
  • Rotate overlapping faceted plates. Widen the aperture near the camera and lower alpha as blur grows. Keep distant haze narrower. Tune brightness in the target's color space, especially at night.
  • Integrate wind in seconds. Differentiate the continuous path before wrapping. Sweep nine weighted samples over 36 ms, cap length near six radii and expand the quad to include blur and travel. Reduce the sample count before increasing flake size on weaker devices.
  • Pass zero delta for reduced motion. Set amount to zero when clear and call dispose on teardown.

Check

Scrub one flake across the wrap boundary at 30 and 60 fps. It should never draw a line across the screen. Hold a dark subject against a pale sky, shift focus and watch nearby flakes soften and fade. Check for square clipping at the fastest gust.


Copyright (c) 2026 Meng To

The license files are attached. MIT

The attached ZIP contains the pinned supporting files cleared for import. Applicable license notices are attached or included when cleared.

Like how this is organised?

Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.