Live data from Hacker News

Show HN: I wrote a C++ ray tracer from scratch without AI

github.com

31–40 of 67 posts

Re: Show HN: I wrote a C++ ray tracer from scratch without AI

#32

Me too, but in TS/WebGPU: https://github.com/ivanjermakov/moonlight Very fun! Packing data for GPU-side BVH was quite tricky.

Wow, pretty good. Why web?

Thanks! Wanted to tackle WebGPU for making browser games.

Re: Show HN: I wrote a C++ ray tracer from scratch without AI

#33

Earlier quoted context omitted.

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 usi…

> Also, as you're using full double/f64-precision all the time, you're leaving a fair bit of performance on the table There's another issue that popped up on my quick naive profiling run: std::shared_ptr in the HitRecord/HittableLightSample is assigned/copied and destroyed a lot, and somehow these refcount operations show up as half of all samples on my profile (presumably because even if there's no hit and the point…

Yeah, passing std::shared_ptr by value in a multi-threaded setup can have a lot over overhead due to them being copied and destroyed a lot, and the fact that the atomic ref count value modifications effectively cause a write back to cache and can cause contention.

Should pass them by const refs really to avoid this.

Re: Show HN: I wrote a C++ ray tracer from scratch without AI

#34
post #9

Earlier quoted context omitted.

> 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 ;)

Thanks! I get your point about AI, but I think it's fair to say it's almost 100% AI free. I worked on it for ~15 months, vs 1 week now with AI. Previous results were quite similar

> 1 week now with AI

1 week is enough to build out a full-featured application with AI if you know what you're doing and are using proper tooling.

You may want to use a better metric to quantify what AI tooling did in the project.

Re: Show HN: I wrote a C++ ray tracer from scratch without AI

#37

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

Wow, I also wrote a game 8 years ago and have been using AI to rebuild upon it. I'm excited to tell people that I wrote it from scratch without AI! Love these new rules!

Re: Show HN: I wrote a C++ ray tracer from scratch without AI

#39
post #9

Earlier quoted context omitted.

> 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 ;)

Thanks! I get your point about AI, but I think it's fair to say it's almost 100% AI free. I worked on it for ~15 months, vs 1 week now with AI. Previous results were quite similar

I am interested in hand-crafted software, and it feels deceptive when you put "no AI" in the title only to reveal there was. If you try to minimise its impact after, one wonders, if the impact was so minimal, why it was necessary. If you worked on it for 15 months without generated code, vs. 1 week with, why not finish the job? What was the purpose of introducing generated code in the last week, and could you not have taken a little more time to do it by hand given you already invested so much time into it?

Re: Show HN: I wrote a C++ ray tracer from scratch without AI

#40

Earlier quoted context omitted.

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.

I get your point. I consider it fair with the disclaimer because the "manual" version was very similar to current but missing some love

Maybe you could set your manual version as the main branch and then have a separate AI-cleaned branch on the side? I think the manual version part is what is exciting people and drawing them in. Even if it is worse or doesn't work!
Post reply on HN