far-shade

Installation
SKILL.md

Far Shade

Target: Three.js 0.187.0, three/webgpu and TSL node materials from three/tsl; WebGPU only, no WebGL fallback, no GLSL strings.

The companion file scripts/far-shade.tsl.js is the atlas, the writer and the shader node. Copy it into the project; it imports only from three/webgpu and three/tsl.

What it is

A fake terrain self-shadow that takes over from a far shadow cascade. The world's heights live in one 1024 x 1024 RGBA8 texture at 4 m per texel, addressed modulo its span (4096 m), so it never needs an origin or a recentre. Each terrain tile writes its heights and rasterises its trees as soft canopy discs when it arrives. Every material that shows terrain (ground, rocks, stumps, cards) runs a short march toward the sun in the vertex stage: 8 height taps, 8 to 270 m out, against a rising horizon line. That gives hill and ridge shadows. One more tap reads the canopy up-sun, and that gives tree shadow blobs. The result is one varying, multiplied into the albedo as a darkening.

It is not a shadow map. Nothing is rendered from the light, no casters are drawn, and the cost is 9 texture taps per vertex plus one 4 MB upload on frames where tiles arrive.

When to use it

  • streamed open terrain (tiles of 64-512 m) seen to 1-4 km, with a sun that moves
  • the far shadow cascade costs too much (a 4096 depth map is 64 MB, and the pass draws everything out to the horizon), or you already run it at a reduced rate and it lags
  • a cheap fake AO on the ground under the near cascade: hollows, the lee of ridges, the ground under forest

Not for: moving casters (vehicles, characters, animals), buildings, poles or anything that is not terrain or a tree; shadows on vertical walls; indoor scenes; small worlds where one cascade already covers everything.

Installs
102
GitHub Stars
8
First Seen
Oct 30, 2026