Skip to content

Feature/sun cascades - #119

Merged
mattvb91 merged 4 commits into
devfrom
feature/sun-cascades
Dec 4, 2026
Merged

mattvb91 merged 4 commits into
devfrom
feature/sun-cascades

Conversation

@mattvb91

@mattvb91 mattvb91 commented Dec 4, 2026

Copy link
Copy Markdown
Member

No description provided.

…efault

The clouds' shadow map was a fixed ±3 km at 512 texels: past 3 km the ground was in full sun. Its reach
and size are now props, in the editor as a slider and a select (with the detail per texel each gives),
and the map follows the camera in steps of its own texels.
One shadow square around the camera had to serve both a mountain's shadow and a tree's: small, and the
mountains' shadows ended in a hard line; large, and the trees' went blurry. With `cascades` 2-4 the view is
split from shadowArea out to shadowDistance, a map each (three's CSMShadowNode), sharp close by and coarser
further out, fading into one another; shadowMargin keeps tall casters sunward of a slice in its map.
Default 1: the one square, as before (each cascade draws the scene again).

The sun light's single shadow node is now skySystem.sunShadow's (sunShadow.ts): the Sun's cascades or
square, with the Clouds' shade on it as a factor, where the Clouds used to replace the node. The cascades
are tied to the game's camera, refitted when its projection changes, and biased per cascade.
The far cascades are drawn on a schedule rather than every frame, and each cascade's map leaves out what lies wholly
down-sun of the points it shades and what's smaller than two of its texels (past the nearest, which keeps every
caster). The cascades see the layers the light's shadow camera does.
@mattvb91
mattvb91 force-pushed the feature/sun-cascades branch from e08519f to 8d12c2f Compare December 4, 2026 19:24
cascadeEnds spreads the cascades in equal ratios from the first to the distance, and stays finite and in order
for a first of zero or past the distance. SunShadow puts the clouds' factor on the light's shadow node, rebuilds
only when it changes, and takes it off again (with no factor, on dispose) without removing a node that isn't its own.
@mattvb91
mattvb91 merged commit 07cf218 into dev Dec 4, 2026
27 checks passed
@mattvb91
mattvb91 deleted the feature/sun-cascades branch December 4, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant