ekzhang / rpt

A physically-based path tracer
Apache License 2.0
411 stars 15 forks source link

Max bounce termination #5

Closed neevparikh closed 2 years ago

neevparikh commented 2 years ago

Hi! I noticed that the renderer currently terminates tracing the ray based on a max_bounce parameter. This, as far as I am aware, isn't unbiased. Instead, one would generally probabilistically decide to continue or terminate, adjusting the monte carlo estimator accordingly (also called russian roulette). However, I am not sure if there's something else that's accounting for this which still makes this approach unbiased.

Would love to know, and am happy to make a PR changing this!

ekzhang commented 2 years ago

Hey Neev, thanks for reaching out. It's correct that there are some minor adjustments to the algorithm that make it technically not unbiased, in particular the max_bounces parameter and some tuning to avoid fireflies. This isn't an issue in practice though. For the example renders we set max_bounces high enough so that it doesn't make a difference.

We used max bounces because it's simpler, easier to understand, and from our observations didn't have a noticeable impact on the output render after a small number bounces. You can see this passage from pbrt.

image
neevparikh commented 2 years ago

Ohh interesting, gotcha.