Log inGet started
Package

sunfall.package

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

Forest (component)

The conifer forest on Sunfall Ridge's lower slopes, drawn instanced with distance levels of detail; put it on one entity at the world origin (the build's dressing/forest). It needs no sibling component and writes nothing to disk.

At start it walks a jittered 5.5 m lattice over the west face, the crest and the near east side and plants a tree wherever the baked landscape lays its forest surface (read from the terrain's own control textures through sunfall.dressing.ground, so trees and forest floor agree texel for texel), thinned by a two-scale clumping noise into stands and gaps. Toward the treeline the trees shrink and turn from spruce and fir to larch and stone pine; past it a few single stone pines, larches and mountain pines stand on the dry grass; dead snags stand in the dense forest. None grow on rock walls, on steep scree, below 420 m, above 1095 m, round the launch or in the meadow's landing circle. About 38,000 trees, built in ~0.3 s.

Each species and variant is one group, sorted into 128 m cells; as the camera moves (every 25 m) the cells are re-sorted, six groups a frame, into three instanced draws per part: near needle cards within 70 m, middle cards within 480 m, far canopy tiers out to range. Only the near level casts shadows, through the middle level's lighter mesh (renderer.setShadowProxy). Draws are registered only once their meshes are resident.

Fields: seed, spacing (m), range (m), farShadows (let the middle level cast too). Methods: stats(), refresh() (re-sort now round the camera or ground.setFocus), suspend() / resume() (drop and rebuild every draw, to measure the frame without the forest).