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.
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.
After lines, I need to be able to draw triangles. The algorithm works something like this:
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.
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!