Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

foliage

const foliage: ModelMaterial

Dresses a model’s leaves and needle cards as foliage: hand it to InstancedModel’s or an entity’s material. Both faces of a card are lit with its front’s normal turned toward its crown’s, and a face seen from behind takes no specular; light passes through a leaf lit from behind; each copy varies its colour a little; an alpha-cut card keeps its cover in the distance and fades where it turns edge-on; a blended one is cut at half its alpha and writes depth, so it sorts and takes ambient occlusion as a cut leaf does. A material with no alpha, such as bark, keeps its own shading. It is defineFoliage(), every option at its default. It wraps a game’s own change outside it, (original) => foliage(warm(original)), keeping that change’s shader hook. The clones live as long as the page.