Instead of taking paths for both the reflection and the Transmission rays at each intersection, im choosing to take only one using the BRDF to bias which route to take. To do this I evaluate the Schlick approximation function which gives me the amount of reflection at this intersection between 0 and 1. I use this and some randomness to decide on which route to take. I then divide by the pdf, but the result is just a white. Taking out the pdf divide gives a noisy but image as predicted, but isnt the divide supposed to be there?
I believe my problem is a normalization of the PDF issue. Not sure though. The left image is taking all paths, and the right is using the below technique (but without the divide by the pdf)
Don't divide by the pdf. Try averaging a few hundred runs of the code that made the image on the right, and you should get something that looks like the picture on the left.
Don't divide by the pdf. Try averaging a few hundred runs of the code that made the image on the right, and you should get something that looks like the picture on the left.
What? When using multiple importance sampling, you need to divide with the PDF, since you are not using a randomly scattered direction on the hemisphere, but a direction what suits the actual BRDF more.
To the author, double check your function implementations...
But from the code it's clear he isn't doing MIS, but Russian roulette sampling. Notice that the pdf he is dividing by has nothing to do with the BRDF being sampled, it's equal to the percentage of light that is reflected by the objects (as opposed to refracted). So dividing by pdf makes no sense.
So do I just leave it as is but without the divide?
I thought I had to dived by the pdf to "boost" up cases where there might be say only 5% reflection and 95% refraction, and the 5% route happended to be chosen, giving almost black in those cases. But now I realise I dont need to boost it becuase Im not actually multiplying the result by the fresnel factor, im just using the fresnel to bias a route of 100% refraction or 100% reflection.
So do I just leave it as is but without the divide?
Yes.
I thought I had to dived by the pdf to "boost" up cases where there might be say only 5% reflection and 95% refraction, and the 5% route happended to be chosen, giving almost black in those cases. But now I realise I dont need to boost it becuase Im not actually multiplying the result by the fresnel factor, im just using the fresnel to bias a route of 100% refraction or 100% reflection.
But from the code it's clear he isn't doing MIS, but Russian roulette sampling. Notice that the pdf he is dividing by has nothing to do with the BRDF being sampled, it's equal to the percentage of light that is reflected by the objects (as opposed to refracted). So dividing by pdf makes no sense.