Painted Metropolis
README.md
shade
This module manages the generation and casting of ambient shade within the painterly system. It builds upon the concept of an occluder map, where each texel stores the absolute altitude of the ground and any objects standing on it (roofs, tree crowns). This map is then used by the ~.core.shadeCast compute shader to determine how much sunlight reaches the ground, creating tShade. tShade is an rgba16f texture bound to every registered material, providing canopy shade (r), top altitude (g), solid shade (b), and a canopy flag (a). Hosts can lay various types of occluders (boxes, polygons, discs) onto the map using functions like shade.box and shade.polygon, and then shade.commit() to upload these changes and re-cast the shade. The shade is re-cast incrementally over frames when the sun moves, or immediately if shade.setSun(..., true) is called. This module is crucial for realistic ambient lighting and shadowing in the painterly world.