logoalt Hacker News

martianotoday at 9:34 AM8 repliesview on HN

Hey HN,

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.


Replies

hresvelgrtoday at 12:07 PM

Great work, the examples look fantastic. I will say, it's misleading to put "without AI" in the title for you to then comment on your submission that you have in fact used it. While it may only be in a trivial capacity, you've still used it.

show 1 reply
smartmictoday at 12:34 PM

> Btw this was initially coded without AI, but I've used it for the recent clean up and features

Then it makes sense to update the submission title. To me it reads as if the project was written completely without the help of AI (which might be a quality badge to some), but it is not 100% true then.

Anyhow, cool project ;)

show 1 reply
pixelesquetoday at 12:33 PM

JFYI: Your inverse ray direction calculation is not NaN-safe: if rays are completely axis-parallel in one dimension, so the direction value is 0.0 for that axis, you'll be doing the val / 0.0 which results in a NaN...

Also, as you're using full double/f64-precision all the time, you're leaving a fair bit of performance on the table: transcendentals (sin(), cos(), etc) in particular - can be a lot slower than when using f32, and generally double precision can be special-cased to particular areas of the renderer that need it (curve, sphere intersection, and some situations where volume scattering produces very small distances).

show 2 replies
MyHonestOpinontoday at 4:47 PM

Amazing. What happened with your professional career ? Did this exercise help you out professionally ?

One of my worries about AI is that doing these deep dives are a lot harder to justify.

show 1 reply
shinycodetoday at 11:50 AM

Congrats on doing 42 and to have worked and shared your project, very nice results !

manojitoday at 12:34 PM

Hey ! Great work , I wanted to try something like this as well to begin my journey into games and computer graphics . I would love to know what resources you used to learn.

show 1 reply
pjmlptoday at 12:34 PM

Congratulations on achieving it.

ttoinoutoday at 11:34 AM

Congrats ! Results look stunning