Hi,
As expected the result does not converge to the right output.
So, I was investigating and I have at least a couple of questions about the Sampler interface:
1. The GetSample method can return 3 different values based on how it is called. If the index is 0 or 1, the value returned is sample0 or sample1, that hold the value for the current pixel being rendered plus a small offset that I assume is to randomly sample the area of the current pixel.
If the index argument is any other value, the value returned depends on the Sampler type. Random returns an absolute random value and the Sobol returns the next value in the Sobol sequence based on the pass and index values in some way I don't understand.
What is this random value used for when the index value is not 0 or 1?
I see that this method is mainly called by the engines such as pathtracer. On this class the method is called with index 0 and 1 like that:
Code: Select all
const float filmX = sampler->GetSample(0);
const float filmY = sampler->GetSample(1);
But it is also called like that:
Code: Select all
camera->GenerateRay(sampleResult.filmX, sampleResult.filmY, &eyeRay, &volInfo,
sampler->GetSample(2), sampler->GetSample(3), sampler->GetSample(4));
const bool isLightVisible = DirectLightSampling(
device, scene,
eyeRay.time,
sampler->GetSample(sampleOffset + 1),
sampler->GetSample(sampleOffset + 2),
sampler->GetSample(sampleOffset + 3),
sampler->GetSample(sampleOffset + 4),
sampler->GetSample(sampleOffset + 5),
depthInfo,
pathThroughput, bsdf, volInfo, &sampleResult);
And in this second case, all are covered by the default case on the switch.
Why do this calls the GetSampler with varying argument values if the result is always the same?
I've tried to implement this new sequence based on the Random and Sobol samplers, but substituting how the values are chosen. To debug I've substituted this new sequence for some rndGen->floatValue() calls in order to compare the results with what I get using the new sequence.
When I use rndGen->floatValue() to determine the sample0 and sample1 values I see no big difference in the rendering, but when I return a random value for the case where index != 0,1 the result looks correct.
I've put some prints and the value return appears to be in the correct range