five-on-it / apps/client/src/renderer/ground-cover
apps/client/src/renderer/ground-cover
Ground cover, low-poly and for the eye only (the simulation never sees it): tufts of grass on green ground, dry tufts on yellowed ground (stubble, dry grass, sand), a few flowers among the grass, and pebbles on bare earth and on steep rock. What grows where is read off the colour of the level's terrain under each point (coverOf), so it follows a region's rich ground, its fields, a town's verges and any level's grass alike, and nothing grows on a road, under water, on a deck, in a building or on paving.
The cover is made a cell of COVER_CELL metres at a time, by a stream of the cell's own (the same cell always looks the same), on a jittered grid, only for the cells the camera sees, and kept for a while after; every kind is one mesh drawn as thin instances, so the whole of it costs three draw calls. Without a GPU there is a quarter as much.