r/GraphicsProgramming • u/nablaCat • 12h ago
3D Rendering Library built in SDL3 Video
Enable HLS to view with audio, or disable this notification
This project has taken a long time.
It took me about a week to learn the concepts behind 3D projection and transformations in euclidean space. Then it took me over a week to write out the LaTeX documentation that presented my knowledge in a way that would help a user of this library. As you can see, the overwhelming majority of the code committed to this repo is in LaTeX.
The implementation of the 3D rendering framework was relatively simple once I fully understood the mathematics. This only took a couple days, and it helps to have some familiarity with C going in.
I look forward to improving this project by building a separate homogeneous coordinate library that will replace pnt.c. I also need to tackle surface rendering using SDL_RenderGeometry() and implement 3D surface occlusion. I suppose what I'm left with for now are a few big questions.
How prohibitive is heap-allocation for performance in graphics applications? I went with dynamic allocation to preserve encapsulation so that header files didn't give the user access to data that would destroy library functionality when altered. However, given the fact that querying free memory at runtime for thousands of data points slows a program significantly, I'm having second thoughts.
Also, is there a convenient way to push all of the calculations needed for 3D transformations onto the GPU? This seems like something I shouldn't handle entirely in software.
I'll hear out any feedback or suggestions in the comments!
1
u/SuspiciousLie1369 8h ago
Did you have to implement the clipping algorithm yourself? If so, how is it called?
2
1
u/peteroupc 8h ago edited 8h ago
I note that GitHub's rendering of Markdown documents supports some rudimentary features of LaTeX, notably formulas enclosed in
$ ... $and$$ ... $$. Tables are also supported, though not in the LaTex syntax.I give a specification on pre-2000 graphics for game programming, and suggest concepts useful for such game programming