### MIS with IBL

Posted:

**Thu Jul 06, 2017 10:51 am**Hi all,

I have a question about something that I can't seem to wrap my head around.

Here's the situation:

In a unidirectional path tracer with next event estimation and MIS lights can be reached by a random bounce and by explicitly sampling the light source. For MIS I thus take both pdfs into consideration, both when I stumble upon the light and when I sample it explicitly. So far so good.

Now, I add in IBL. In my first implementation, I randomly select either the skydome or one of the lights for next event estimation (50/50). When I stumble upon the light, I use the pdf for sampling a light scaled by 0.5 to account for the fact that I could have sampled it with 50% probability. Same for the sky. This produces a correct image, so I believe this method is correct and unbiased. Any other probability for light/sky works, including 0 and 100%.

Obviously, some parts of the scene benefit more from lights than the skydome. So, I want to change the probability of sampling the light or the sky depending on potential contribution. So I evaluate a random point on the skydome (importance sampled) and a random point on a random light. Based on these 'potential contributions' I determine the probability of sampling a light or the sky. This probability is recorded, so that when I stumble upon a light or the sky I can use it like I used the 0.5 in the previous scenario.

Sadly, this introduces bias, although subtle, and I can't figure out what I am doing wrong.

One thing that I realized is that when the random selected light happens to be behind the point that is being evaluated the potential contribution is 0, and therefore the sky will be selected with a probability of 1. However, another light may in fact be visible, so when I stumble upon it the MIS probability for sampling it explicitly is wrongly set to 0. So I clamped the light/sky probability to the range of 0.1..0.9 to ensure that both at least have a chance of being selected, but this feels wrong, bias remains (although the situation is better) and it looks like I am not understanding something here.

Any ideas?

I have a question about something that I can't seem to wrap my head around.

Here's the situation:

In a unidirectional path tracer with next event estimation and MIS lights can be reached by a random bounce and by explicitly sampling the light source. For MIS I thus take both pdfs into consideration, both when I stumble upon the light and when I sample it explicitly. So far so good.

Now, I add in IBL. In my first implementation, I randomly select either the skydome or one of the lights for next event estimation (50/50). When I stumble upon the light, I use the pdf for sampling a light scaled by 0.5 to account for the fact that I could have sampled it with 50% probability. Same for the sky. This produces a correct image, so I believe this method is correct and unbiased. Any other probability for light/sky works, including 0 and 100%.

Obviously, some parts of the scene benefit more from lights than the skydome. So, I want to change the probability of sampling the light or the sky depending on potential contribution. So I evaluate a random point on the skydome (importance sampled) and a random point on a random light. Based on these 'potential contributions' I determine the probability of sampling a light or the sky. This probability is recorded, so that when I stumble upon a light or the sky I can use it like I used the 0.5 in the previous scenario.

Sadly, this introduces bias, although subtle, and I can't figure out what I am doing wrong.

One thing that I realized is that when the random selected light happens to be behind the point that is being evaluated the potential contribution is 0, and therefore the sky will be selected with a probability of 1. However, another light may in fact be visible, so when I stumble upon it the MIS probability for sampling it explicitly is wrongly set to 0. So I clamped the light/sky probability to the range of 0.1..0.9 to ensure that both at least have a chance of being selected, but this feels wrong, bias remains (although the situation is better) and it looks like I am not understanding something here.

Any ideas?