Repository navigation
Feature/sun cascades - #119
Merged
Merged
Conversation
…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
force-pushed
the
feature/sun-cascades
branch
from
December 4, 2026 19:24
e08519f to
8d12c2f
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.