Last Updated: 24th September, 2022

Software Renderer

Short Term Goals:

In short, my aim is to truly GET 3D. I've read tutorials for quite a while, but never truly understood what any of it meant. I aimed to change that in the summer of 2022.

I've split development into three main parts.

Rendering 3-D Points in Two Dimentions

This is the most important element of the project. My main point of reference here is the wikipedia article on 3D projection. To make things easier, I created a simple matrix multiplication algorithm in python. This allowed me to directly enter in the algorithms without simplifying them out of their matrix forms into normal formulas.

With this, we can successfully give the program 3 values representing a point in 3d space, and recive 2 values representing that point as it appears at the given angle from a given camera perspective (though the camera positioning element is still a work in progress).

At this point I began doing research about OBJ files. I made a small parser that opens the file, and sends all the point data to the projection function for rendering on the screen.

Initially I chose to use a library called graphics.py for its ease of use. I've since switched to pygame due to its speed and performance. Rest assured however, at this point the only command I'm using is the draw pixel command, all else (see below) is done by my program.

Drawing Lines

WIP

Drawing Triangles

After lines, I need to be able to draw triangles. The algorithm works something like this:

  1. Get three 2-dimensional Points
  2. Order points by X value from lowest to highest... AKA left to right (leftPoint, centerPoint, rightPoint)
  3. find midpoint between leftPoint and rightPoint (midPoint)

I use QBasic to plan out simple graphics ideas like this because of it's accessability.

Aside about the Z buffer The Z buffer algorithm I'm using takes the distance between the midpoint of each triangle and the camera, so that when the trinagles are placed on the screen, the closer triangles are overlayed by the closer ones.

Current State

This is very much a work in progress, but I'm quite happy with the results. I've elected to use pygame's line function for this demo, and the triangles are still not implamented into the full program (yet), BUT we can still render 3d models!

Future Goals