A very very very simple 3D renderer with ASCII. This only works on systems that support the Python curses library (i.e. Unix systems).
As of now, it simply:
- Defines a triangle and a quad.
- Conducts interpolation on the vertices of both objects, to get intermediate vertices to be drawn.
- Projects all vertices onto the screen (i.e. drawing them to the screen)
- Rotates both the triangle and quad along their origins, and re-computes (2.), (3.).
python renderer.py
This project was inspired by the work done in Donut Math.
- The perspective rendering, along with the use of the characters
.,-~:;=!*#$@
for 'illumination' were taken from there. - Further, the math to compute rotations was taken from this Wikipedia article.
- Rendering of larger geometric objects could be potentially done.
- Optimisation of surface rendering of intermediate points (should draw more for closer objects, less for further objects)
- Use of
itertools
for drawing of edges