Implement spotlight shadow mapping and refactor rendering pipeline
- Implement ShadowMap and ShadowRender classes for spotlight shadows.
- Update Spotlight to support shadow mapping using spotlight-shadow-fs.
- Implement frustum culling for shadow casters.
- Rename castShadows to shadowCaster in nodes and assets for clarity.
- Rename trans variable to modelMtx across the codebase for consistency.
- Add shadowEnabled flag to Spotlight.
- Update Scene and Render to handle shadow caster registration and rendering.
- Refactor skinned mesh asset and node to support shadow pass.
- Add buf-debug-fs for shadow map visualization.
Implementing shadows is pretty hard. Either I’m in a bit of a brain fog, or it’s just tough—maybe both. I’m actually glad I decided to tackle it now; seeing how much I’ve had to refactor the engine, it would’ve been even harder later on. I would’ve had to jack up the whole game and restructure it at the foundational level.
Okay, I wanted to implement cascaded shadow mapping with soft shadows this weekend, but I ended up with something else: only spotlights and no cascades. Still, it’s not nothing.