vkoskiv / c-ray

c-ray is a small, simple path tracer written in C
MIT License
797 stars 44 forks source link

Iterative path tracer version #72

Closed madmann91 closed 4 years ago

madmann91 commented 4 years ago

This PR implements an iterative path tracer version, which should boost performance a little. I don't think it should be merged as-is right now, because of the following reasons:

Anyway, thank you for taking the time to review this (and the previous) PR. I know it can take some time so there is no hurry, this can wait a bit. I'll make whatever change you need to push this forward.

vkoskiv commented 4 years ago

I'm all for moving to an iterative path tracing loop. In fact, I've been intending on moving away from that recursive approach for a while now. The only benefit to the recursive approach IMO is that the code is "nifty", but that's not really a good design motivation for something like this. Agreed about it being more confusing than an iterative loop.

I don't think the existing path tracer is correct

This is very much possible. The only way I verified it when I implemented it is that I checked that both with and without RR converged to the same result. But it's been a while, so it's possible I had a rather lax definition of 'same result'.

The first commit of this PR keeps this behaviour unchanged.

This can and should be changed if you think it's incorrect. Comparing the results then determines which approach is better!

Anyway, thank you for taking the time to review this (and the previous) PR.

Thank you! I'm still struggling to put into words just how much your contributions here mean to me. It's really incredible to have someone else helping out like this after many years of mostly solo work.

madmann91 commented 4 years ago

I think this PR is now ready to be merged. The Russian Roulette has been fixed, but I see there is still a couple of problems with the material system. See #75.