Realtime 3d shadows
Realtime 3d shadows
Project started following a question on 3d clipping on this forum and quickly spiraled into a full blown 3d renderer with support for real-time shadows and camera space clipping :
Shadows are calculated in real-time by extruding a shadow volume from each lit face.
Resulting polygons are added to the face and renderedsorted with the face.
The shadows are globals e.g. self-shadowing is supported, see torus scene.
Performance-wise this is bordering what pico can support, as many clipping operations are required to generate shadow polygons. There is room for optimization (vertex cache, smart selection of clipping planes) left to the reader!
Sources
Project (including how to add custom 3d models) is available here: github
Acknowledgements:
3d papers from the 70s80s are pure gold!
trifill function from @p01
Update 1.1
fixed polygon gaps (using correct middle screen position + ceil)
License: -