Variance computation
chaosink opened this issue · comments
I saw the variance computation code.
scaled[i] = _variance[i]/T(_sampleCount[i]*max(uint32(1), _sampleCount[i] - 1));
The variance is divided by spp additionally. Is that intentional considering the variable name is scaled
?
In rendering, "variance" has two different meanings - it is either the sample variance of a set of samples, or the variance of the mean of the samples. If there are N samples, then the sample variance would be obtained by dividing by (N-1). If you want the variance of the sample mean, then you need to divide by N*(N-1).
In Tungsten and its denoiser, I always deal with the variance of the sample mean, hence the division by N*(N-1). This is intended.