ecann / RenderPy

A software renderer written from scratch in Python 3, using only modules from the Python Standard Library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RenderPy

A software renderer written from scratch in Python 3, using only modules from the Python Standard Library. cow

To Run

python3 render.py

Modules

Image.py

Contains an image class capable of generating an image and exporting it to a PNG. Images are implemented as a buffer of 32-bit RGBA pixel color data stored in a byte array. This modules uses zlib and struct for compressing and packing PNG data.

Shape.py

Classes representing points, lines and triangles. Each has a draw() method for drawing that shape in an Image. Anti-aliased lines are drawn using Wu's Line Drawing Algorithm. Triangles are drawn by iterating over a bounding box and calculating barycentric coordinates to smoothly interpolate color over the shape.

Model.py

Class with functions for reading a .obj file into a stored model, retrieving vertices, faces, properties of the model.

Render.py

Implements the rendering pipeline. Loads a model, transforms vertices, computes shading, rasterizes faces into triangles, and outputs the final image to a PNG.

Milestones

12/29/17 – Hidden surface removal using Z-buffer

cola

12/23/17 (1 year later πŸ˜›) – Smooth shading using vertex normals

cow

12/24/16 – Simple n*l flat shading

cow

9/13/16 – Load model from .obj file, rasterize and render with triangles

cow

9/11/16 – Draw triangles

cow

8/27/16 – Draw lines with Wu's Algorithm

8/19/16 – Image module wrapping a color buffer, PNG writer

About

A software renderer written from scratch in Python 3, using only modules from the Python Standard Library.

License:MIT License


Languages

Language:Python 100.0%