3 ms·
The way I learned was by figuring it out myself through hacking. I decided to start with a program that could set the color of a single pixel, then tried to fig
by accatyyc 9y ago
The way I learned was by figuring it out myself through hacking. I decided to start with a program that could set the color of a single pixel, then tried to figure out how to draw a line from that, and from that to a triangle. After that, try to use the Z value of your points to draw a box from lines with some kind of perspective. With a good background in math, most of these algorithms should be relatively simple for you to figure out. After that, you’re not too many lines of code from rendering full 3D models. Doing it this way, I learned how shaders work by having to figure out manually why they are actually needed. Here is my project, which can now render textured objects in real time with multiple light sources: https://github.com/accatyyc/c-3do https://github.com/accatyyc/c-3do
I still have no idea how to do “correct” perspectives. This is just something I hacked together until it looked good.
I can very much recommend doing a project like this. You will naturally figure out how 3D graphics work, and it’s simpler than it appears.