My attempt at making my own 3d renderer. The code is not clean and it's quite laggy, but I'm overall satisfied with it, and I learned some new stuff. You can change the object being displayed by editing the source code. I'm not planning on optimizing it for now.
Controls:
Left/Right : rotate Y
Up/Down : rotate X
C/X : rotate Z
Player 2 Up/Down (E/D) : Zoom/Dezoom
01/may/2023 update :
New revision. Surface lighting, camera perspective, and better face sorting.
Pause -> "Disco colors" to enable disco faces
Pause -> "Obj" to switch between donut/teapot



Cool. I want to tinker with hand-rolled 3D rendering stuff at some point, too. PICO-8 is perfect for this. Nice work!
Out of curiosity, when you studied how to do this, how deep did you go in the math...I always struggle with a mental hangup when I go to work with algorithms like this, and feel that I must go as far as understanding linear algebra upside down forwards and backwards and learn all the proofs---but I don't actually do this, and get discouraged and then don't actually do anything. Whereas, I should probably just treat the formulas others have discovered for 3D math as a black box and just use it rather than try to learn how to re-derive everything myself. I mean there's a reason why there are programmers, and mathematicians. I'm not a mathematician.



@gradualgames I did it mostly based off knowledge I already had, and sort of looked up the math on the fly whenever I needed it. I can recommend you these two resources: http://www.sunshine2k.de/coding/java/TriangleRasterization/TriangleRasterization.html and https://www.youtube.com/watch?v=ih20l3pJoeU&t=1386s
Good luck!
[Please log in to post a comment]