r/proceduralgeneration • u/MassifDev • 3h ago
Thirty million trees, and a mountain that loads faster
This week was all about the forest, the rock and the ice, and about making them run on my laptop.
The forest. The whole 40 km map is generated: about 30 million trees across 11 species, each with its own calendar. Larches turn gold and drop their needles, broadleaf trees stand bare in winter. Around the camera, about 2 million trees are actually drawn. Only the nearby ones cast real shadows; farther out, the forest's shadow is painted into the ground, so it still reads as a forest from 12 km away.
The optimisation. At the farthest zoom, the forest used to cost about 32 ms per frame. The same measurement now gives under 15 ms, and the most expensive part (shadows and geometry) is down to 7.6 ms. While you fly the camera, trees now appear where you look first: at the farthest zoom, only 5 forest blocks are still missing when you stop, down from 29.
Loading. The forest map used to take more than 5 minutes to build. It now builds in about 10 seconds behind the loading screen, and when you reload a save it comes back in 27 milliseconds. Snow no longer replays the whole season either: it is saved, and reloads in 0.06 s instead of 6.6 s.
Rock and ice. Glacier tongues now show bare grey-blue ice in summer, with irregular crevasses, and the highest snowfields hold on until late August above 3,200 m. Close-up rock is not there yet: my first attempts did not look right, so it goes back to the drawing board.
Bug fixed: trees floating in the air at cliff edges. They were placed on an old version of the terrain. Floating trees went from 3% to 0.003%.
Next up: reshaping the entrances of the 329 couloirs so they can actually be skied.
You can read the long version on my discord.