Log inGet started
Package

terrainSystem.package

Newest version

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

README.md

terrain_pyramid

Writes one level of a heightfield's lattice pyramid from the level below it, one thread per level point.

The heightfield's texels are level 0, read along the lattice the terrain's collider stands its samples on (the field's two edges and every texel centre between them, or, for a field whose first and last texel stand on the edges of the rect it is drawn over, the texels themselves). Level k holds one height at every stop m * 2^k of that lattice. Each is the separable tent [1/4, 1/2, 1/4] over the previous level's stops 2m - 1, 2m and 2m + 1, and a stop past an end of a level reads the level's last one. A level's stops are stops of the level below, so a coarse node of the mesh draws the even vertices of the node one level finer, filtered over the ground between them.

A stop on the field's own edge filters along the edge only, so two fields that meet along an edge and hold the same heights there hold one value at every coarse stop of it. The four corners keep the corner texel's height.

A dispatch writes the rect of destination points its parameters state: the whole level when the pyramid is built, and the points an edit reaches when it is rebuilt. Levels are dispatched in order, each reading the one the dispatch before it wrote.