r/GraphicsProgramming • u/Brhaka • Jun 16 '26
I wrote a C++ path tracer from scratch without AI
https://github.com/themartiano/luz
5 years ago I was 17 and learning to code C/C++ in a coding bootcamp (42). One of the projects was a simple C ray tracer. I really enjoyed working on the project and always loved computer graphics, so I decided to create my own path tracer from scratch, in C++, without using any third-party libraries.
I ended up working on it consistently for over a year, then sporadically when CG excitement hit me again. Recently I polished it and completed some unfinished features and decided to make it public, finally. It's a C++20 Path Tracer with a CPU renderer. It is able to render good-looking images with reasonable performance and sample count.
Btw this was initially coded without AI, but I've used it for the recent clean up and features. This project is a personal favorite of mine, and it can improve a lot, so I'd love to hear your feedback.



43
u/Quozca Jun 16 '26
I'm 46 and I've been coding since I was 8 years old on Commodore 64. Iโve been working as a professional developer for over 20 years, and Iโm convinced Iโm a decent coder, but then I see these projects created from scratch by a 23-year-old and it really gets me down! ๐
36
u/PixlMind Jun 16 '26
Very cool project, especially for such a young age.
7
u/PantuflasDev Jun 16 '26
Insane work brother
6
u/BroccoliSenior5465 Jun 16 '26
Mind at least sourcing loosely any papers or literature you used as a guide?
5
u/[deleted] Jun 16 '26
Feedback: 1. congratulations, you're doing great. 2. keep reading and studying the field. Take a look to technical papers from SIGGRAPH, ACM transactions on graphics, Elsevier computer graphics and the Sebastian Lague youtube channel.
There are a lot of things to learn and master.
3
u/doueverwonder Jun 20 '26
Hello there fellow 42 student, good to see you make amazing stuff :)
4
u/alimmka Jun 16 '26
Nice work! Btw, I heard about that bootcamp from some people. Would you recommend it?
2
u/suncoast_customs Jun 16 '26
Nice work. Starred
2
u/moschles Jun 16 '26
The first thing that popped at me is that you did something with the camera to simulate DOF. (unless you post-processed).
2
u/JohnyTheCarrot Jun 17 '26
Where did you find this scene?
2
u/Several-Attempt-9650 Jun 18 '26
Any tips for learning how to accomplish this awesome feat without using AI? I do like using AI to learn concepts, but really enjoy the coding/learning process without it. I always get stumped eventually though and end up using claude to guide me more... While it does help, it does still feel like cheating to me at times. Any research tips you can share?
2
u/compugineer44 Jun 22 '26
the storm troopers rendering looks really cool, cinematic even! I just finished my read of RTIOW, did you complete all three books before this or jus RTIOW? btw, I'm actually trying to modify the existing architecture in the book, for real time rendering performance. Could u give a gist of what architectural changes you had to learn/implement/add to achieve this....
2
u/KlayEverHood Jul 11 '26
Impressive! I started exploring the simpler route of gpu driven path tracing where much of the work is done for us by nvidia. Why did you go for a cou implementation? Did you compare with gpu?
I have a post here using GPU vulkan path tracing and a more brute force GPU example here:
https://youtu.be/nmLDRxY1Twk?is=VbKyWcLWhBuhYi7R
64
u/adorable_samoyed Jun 16 '26
Cool project, output looks really cool. Whether you use AI or not, as long as you are honest with yourself and develop your skillset and solid fundamentals you can go a long way.
2
u/bonghotdogwater Jun 16 '26
Good work bro, nice to see younger people in low level graphics, Iโm 21 and currently working on a couple different renderers for a game engine Iโve been working on for a few years now
1
u/Remote-Tourist6117 Jun 18 '26
Did you used Opengl or Vulcan ?
1
u/[deleted] Jun 18 '26
Vulkan ?
1
u/Still_Explorer Jun 16 '26
The code is awesome to look at, very well written.
1
u/olesgedz Jun 16 '26
Yey, follow 42 student, hello! That is great job!
2
u/N3BB3Z4R Jun 16 '26
Haha and me doing a raycaster for fun and get amazed myself...
2
u/[deleted] Jun 17 '26
hell yea amazing work OP!
2
u/herocoding Jun 19 '26
Looks really great, thank you very much for sharing!!
2
u/_k5h1t1j_ Jun 19 '26
Crazy how you have to specify nowadays that no AI has been used to make it, to make it sound impressive.
Really amazing though, looks pretty realistic, good work!!
2
u/Buzzo239 Jul 10 '26
Looks great!
3
u/CommunismDoesntWork Jun 16 '26
Nice. Now do it in rust and compare the dev experienceย
2
u/entro_play Jun 16 '26
I love you
1
u/Just-Conversation857 Jun 19 '26
Loooks amazing! What are the features of yoru raytracing model? what physicas questiosn etc?
-2
u/epyoncf Jun 16 '26
Do I see correctly that the actual render logic is spread among several unrelated files using free functions? Is there any logic to this architecture?
0
u/[deleted] Jun 16 '26
[deleted] โ view deleted comment
2
u/[deleted] Jun 20 '26
[removed] โ view removed comment
2
u/[deleted] Jun 16 '26
[removed] โ view removed comment
-2
u/[deleted] Jun 16 '26
[removed] โ view removed comment
-6
u/[deleted] Jun 16 '26
[removed] โ view removed comment