9
$\begingroup$

I want to model rays with a continuous range of frequencies so that I can get raytraced images with colour separation on refraction. I can model a light source with a specified frequency distribution by using the distribution to affect the probability of a random ray lying in a given frequency range, or alternatively I can choose frequencies from a uniform random distribution and make the brightness of each ray proportional to the frequency distribution at its particular frequency. I see the first as more physically accurate, but I suspect the second will give images that look "finished" with fewer rays. Is this intuitive suspicion correct? Are there any features that will be lost from the image with the second approach? Is there a way to get some of the speed increase without compromising the image?

$\endgroup$
9
$\begingroup$

Generally, uniformly-weighted samples with a variable distribution (importance sampling) gives lower variance in the final average than uniformly-distributed samples with variable weights. This is a common rule of thumb in Monte Carlo raytracing.

However, another thing to consider is that you'll eventually be converting the images to RGB for display (I assume). So a potential problem might be that if a light source has very little energy in the blue part of the spectrum, for instance, then you'll put few samples in the blue frequencies, and the blue channel of the final RGB image could end up excessively noisy compared to the other channels.

One way to resolve this might be to consider the product of the light source's spectrum with the RGB color-matching curves used to generate the output. You could normalize the three against each other to ensure you get enough samples in all three channels, but still distribute the samples to the most important frequencies for each channel.

On balance, I suspect that simply using a uniform frequency distribution of samples will be simpler and give good results as long as the light source spectra are fairly smooth. But if you have spectra with sharp spikes (e.g. LEDs, lasers, fluorescent lamps) then spectral importance sampling will probably be necessary.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.