Content uploaded by Witold Alda
Author content
All content in this area was uploaded by Witold Alda
Content may be subject to copyright.
An Improved Technique for Full Spectral Rendering
Michal Radziszewski
AGH, Krakow, Poland
mradzisz@student.agh.edu.pl
Krzysztof Boryczko
AGH, Krakow, Poland
boryczko@agh.edu.pl
Witold Alda
AGH, Krakow, Poland
alda@agh.edu.pl
ABSTRACT
In this paper we present an improved approach to full spectral rendering. The technique is optimized for quasi-Monte Carlo ray
tracing, however the underlying physical theory can be applied to any global illumination scheme. We start with explanation
of the necessity of full spectral rendering in any correct global illumination system. Then we present, step by step, a rendering
scheme using full spectrum simulation. First, we give details on a random point sampling as a method of representing spec-
tra, then we introduce improved spectral sampling technique, designed to reduce variance of image of wavelength dependent
phenomena, and finally we show how to integrate the novel sampling technique with selected ray tracing algorithms.
Keywords: Full spectrum, quasi-Monte Carlo, ray tracing, rendering.
1 INTRODUCTION
The color phenomenon is caused by a spectral mix-
ture of light, perceived by the human visual system.
However, the human visual system cannot distinguish
between arbitrary spectral light distributions. Differ-
ent spectra, which are indistinguishable by human ob-
servers, are called metamers. The space of colors rec-
ognizable by human observers contains only three in-
dependent values, hence the popularity of three compo-
nent color models.
There are many color models in computer graphics,
however most are designed for a specific purpose only.
The most common are: RGB designed for displaying
images, CMYK for printing and HSV for easy color
selection by user. All of these models are to some de-
gree hardware dependent. There is, however, a standard
model based on XYZ color space, which is independent
of any hardware and can represent all the colors rec-
ognizable by a human observer. It was defined by the
CIE (Comission Internationale de l’Eclairage) as three
weighting functions to obtain x,yand zcomponents
from arbitrary spectra. Nevertheless, neither of these
models is well suited for rendering, where direct calcu-
lations on spectra are the only way to produce correct
results [4, 9].
2 NECESSITY OF FULL SPECTRUM
The RGB model is often used for rendering color im-
ages. However, this is an abuse of it, since RGB based
rendering does not have any physical justification. The
Permission to make digital or hard copies of all or part of this work
for personal or classroom use is granted without fee provided that
copies are not made or distributed for profit or commercial advantage
and that copies bear this notice and the full citation on the first page.
To copy otherwise, or republish, to post on servers or to redistribute
to lists, requires prior specific permission and/or a fee.
model was designed for storage and effective display of
images on a monitor screen, but not for physically ac-
curate rendering. The light reflection computation un-
der the assumption of elastic photon scattering is per-
formed by a multiplication of a spectrum that represents
an illumination and a spectrum describing a surface
reflectance. This multiplication actually must be per-
formed on spectral distribution functions, not on RGB
triplets, in order to get proper results.
The RGB based reflection of white light, or light
with smoothly varying spectrum, from a surface with
smoothly varying reflectance, typically does not pro-
duce substantial inaccuracies. However, when at least
one of spectra has large variation, the simulation us-
ing RGB model becomes visibly incorrect (see Figure
1, for example). Moreover in global illumination, due
to multiple light scattering, even white light becomes
colorful, causing scattering inaccuracies to accumulate.
This makes RGB based global illumination results un-
able to accurately capture the physical phenomena.
Figure 1: Left image: copper sphere illuminated by
a D65 white light. Right image: copper sphere illu-
minated by a triangular spectral distribution stretched
from 535nm to 595nm. Top left half: an RGB model
with 645nm, 526nm and 444nm wavelengths. Right
bottom half: our full spectral model. For clarity, only
diffuse reflection is calculated.
In addition, the most visually distracting error from
using an RGB model appears in simulation of phenom-
ena like dispersion. Whenever RGB based light, from
a light source with almost parallel output rays, hits a
prism, it is scattered into three bands instead of contin-
uous full spectrum, and the rest of the image remains
dark (see Figure 2), which looks unrealistic. Using a
full spectrum representation gives a continous rainbow
of colors. However, good-looking results may be ob-
tained by an RGB representation if the light source an-
gular distribution is conical and divergent enough. A
similar trick is a basis of a simple Nvidia shader demo
[5]. An address of the texture on a surface, which is
seen through glass, is offseted independently for each
channel. If texture data is blurred enough, the result-
ing ’spectrum’ is smooth. Nevertheless, both of these
methods do not have any physical significance, and ob-
viously are incorrect, but, in some conditions, can look
convincing.
Figure 2: Dispersion on a prism. Top row: RGB model
with 645nm, 526nm and 444nm wavelengths. Bottom
row: physically correct full spectrum. The light colli-
mation is controlled by a Phong-like function Icosn(φ),
with exponent ndecreased four times in each subse-
quent column, and intensity Idoubled to compensate
light scattering.
3 RELATED WORK
A general description of many popular color models
can be found in Stone [16]. Devlin et al. [1] provide
references related to data structures for full spectral
rendering and algorithms for displaying spectral data.
There are several works dedicated to simulation of par-
ticular spectral based phenomena. Wilkie et al. [22]
simulated dispersion by means of classic (determinis-
tic) ray tracing. Rendering of optical effects based on
interference attracted a fair amount of attention. Reflec-
tion from optical disks is presented in Stam [15] and
Sun et al. [17]. Algorithms for accurate light reflection
from thin layers can be found in Gondek et al. [7] and
Durikovic and Kimura [3]. The latter paper also shows
how this algorithm can be run on contemporary GPUs.
Many papers present methods for representing and
operating on spectral data. Peercy [12] designed a spec-
tral color representation as a linear combination of basis
functions, chosen in a scene dependent manner. Dif-
ferent algorithm using basis functions is described by
Rougeron and Peroche [14]. It uses adaptive projec-
tion of spectra to hierarchical basis functions. Sun et
al. [18] proposed a decomposition of spectra on smooth
functions and set of spikes. Evans and McCool [4] used
clusters of many randomly selected spectral point sam-
ples. Johnson and Fairchild [9] extended OpenGL hard-
ware rasterization to support full spectra.
Dong [2] points that typically only a part of the scene
needs a full spectral simulation and using RGB together
with full spectrum can accelerate rendering at cost of
only slight quality loss. Ward [21], however, designed a
three-component model optimized for rendering, which
typically produces images with an acceptable yet im-
perfect quality, but the model is not general enough and
cannot simulate wavelength dependent phenomena like
dispersion.
4 REPRESENTING FULL SPECTRA
Full spectral rendering requires an efficient method for
representing spectral data. The most common tech-
niques are based on linear combinations of carefully se-
lected basis functions [12, 14, 18] and point sampled
continuous functions [4]. Effectiveness of the linear
combination approach is strongly dependent on the ac-
tual functions and their match to scene spectral distri-
bution. However, the natural solution in Monte Carlo
based rendering system is a random point sampling.
4.1 Random Point Sampling
Random point sampling produces noise at low sam-
pling rate, but well-designed variants of this technique
converge quickly. Point sampling can effectively han-
dle smooth (like tungsten bulbs) light distributions and
very narrow spikes (like neon bulbs) in the same scene.
The two greatest strengths of this technique are: ran-
domly selected wavelengths and well defined wave-
length value for each spectral sample. The first one
ensures correctness, since when more samples are com-
puted, the more different wavelengths are explored, and
due to the law of large numbers, the rendering result
converges to the true value. The second allows simulat-
ing wavelength dependent effects like dispersion at the
cost of additional color noise.
It is worth to note that wavelength dependent phe-
nomena cannot be simulated correctly with algorithms
based on linear combinations of basis functions with
non-zero extent in wavelength space. Even if spec-
tra are represented by unique non-zero coefficients, the
corresponding basis functions still have some finite ex-
tent, which prevents from doing exact computations
with explicit wavelength required.
The simplest approach to point sampled spectra is
generation of a single spectral sample per light trans-
port path. However, according to Evans and McCool
[4], this technique is inefficient, since it causes a lot of
color noise. They proposed using a fixed number of
several spectral samples (called a cluster of samples)
traced simultaneously along a single light path, which
substantially reduces variance with minimal computa-
tional overhead.
4.2 Basic Operations
The implementation of multiplication, addition, mini-
mum, etc. operators are obvious, since it is enough to
perform appropriate calculation per component, as in
RGB model. However, when using full spectrum, com-
puting luminance is a bit more difficult. Particularly,
luminace of a spectrum which describes reflectivity of
a surface, by definition must be in [0,1]range.
However, computing luminance as a Monte Carlo
quadrature of product of reflectance spectrum r(λ)and
scaled CIE yweighting function, may randomly lead
to numerical errors causing luminance to exceed 1.0
threshold. The equation:
L≈
n
∑
i=1
r(λi)y(λi)
p(λi).n
∑
i=1
y(λi)
p(λi),(1)
where r(λ)is the reflectance, y(λ)is CIE yweight and
p(λi)is a probability of selecting given λi, solves the
issue. It guarantees that the luminance is in [0,1]range,
provided that r(λ)is also in the specified range.
Wavelength dependent effects can be handled as pro-
posed by Evans and McCool [4] for specular dispersion
– by dropping all but one spectral sample from a clus-
ter. This is done by randomly selecting a sample to pre-
serve, with uniform probability. All the samples, except
the selected one, are then set to zero, and the power of
the chosen one is multiplied by the cluster size. Then
the wavelength parameter becomes well defined, and
further computations are performed with usage of its
actual value. However, when simulated phenomena are
not optically perfect, like in Phong-based glossy refrac-
tion, it may be more efficient to trace the whole cluster,
scaling power of each sample independently. We exam-
ine this approach in detail in the next section.
5 SAMPLING OF SPECTRA
Evans and McCool [4] simulate wavelength dependent
phenomena by tracing only one spectral sample per
path. This particular approach is always correct, and
is necessary when a phenomenon is optically perfect,
such as refraction on idealized glass. However, when
the scattering is not ideal, dropping all but one spectral
sample from a cluster, while still being correct, might
be extremely wasteful and inefficient. In this section
we propose a substantially improved technique.
5.1 Single Scattering Model
For testing purpose, a refraction model with an ad-
justable, wavelength dependent refraction and imper-
fection introduced by Phong-based scattering [13], with
controllable glossiness is used. An extension to Walter
et al. microfacet based refraction [20] supporting dis-
persion gives better results, but their model is much
more complicated and therefore would make evaluation
of spectral sampling difficult. Nonetheless, since we
have never made assumptions about scattering model,
our results are general and, as we have tested, applica-
ble to any wavelength dependent phenomena. For clar-
ity, all tests are based on a single scattering simplifica-
tion (i.e. light is refracted once, when it enters into glass
only). The xcomponent in CIE XYZ space in outgoing
direction ωois then described by the following formula:
ICIEx (ωo) = ZΛZΩ
fs(ωi,ωo,λ)Lλ(ωi,λ)·
·wCIEx (λ)dσ⊥(ωi)dλ,(2)
where Λis the space of all visible wavelengths, Ωis the
space of all direction vectors, Lλ(ωi,λ)is the radiance
incoming from direction ωi,wCIEx is the CIE weight for
xcomponent, and σ⊥(ωi)is the projected solid angle
measure. The yand zcomponents can be evaluated in a
similar way. In the rest of this section, the Formula (2)
is written in a simplified, still not confusing, form:
I=ZΛZΩ
f(ω,λ)L(ω,λ)w(λ)dσ⊥(ω)dλ.(3)
5.2 Basic and Cluster Based Monte Carlo
Estimators
The Monte Carlo method (Equation 14) can be applied
to evaluate the two integrals from Formula (3), which
leads to the following estimator:
I≈1
N
N
∑
i=1
f(ωi,λi)
pΩ(ωi,λi)
w(λi)
pΛ(λi)L(ωi,λi),(4)
where pΩis the probability of selection of a given
ωievaluated with the σ⊥(ω)measure on Ωand pΛ
is the probability of selection of a given λi. Quality
of this estimator, and all the further estimators in this
section, relies on the assumption that scattering model
offers proper importance sampling (Equation 15), i.e.
f(ω,λ)∝pΩ(ω,λ)is roughly satisfied. However, this
basic estimator is inefficient, because it forces the num-
bers of spectral and directional samples to be equal.
Each directional sample requires additional rays to be
traced, which is computationally expensive, while spec-
tral samples are almost for free. This explains the ad-
vantage of clusters of spectral samples over a single
spectral sample approach.
The main improvement over Evans and McCool
method is tracing a full cluster of spectral samples,
even when wavelength dependent phenomenon is en-
countered. Wavelength dependence can be defined pre-
cisely as the dependence of pΩon λ. If scattering is
not wavelength dependent, directional sampling is not
wavelength dependent as well, i.e. pΩ(ω,λ)≡pΩ(ω).
In our method, a particular spectral sample λs
iis se-
lected at random from a cluster, and its value is used
for sampling ωs
i. This leads to the color estimator in
the form:
I≈1
NC
N
∑
i=1
C
∑
j=1
f(ωs
i,λj
i)
pΩ(ωs
i,λs
i)
w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i) =
=1
NC
N
∑
i=1
1
pΩ(ωs
i,λs
i)·
·
C
∑
j=1
f(ωs
i,λj
i)w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i),(5)
where Nis the number of traced clusters, Cis the num-
ber of samples in each cluster, and pΩis the probability
of selecting scattering direction, calculated for the se-
lected wavelength λs
i. The estimator (5) can be more
efficient than estimator (4), since it traces Cspectral
samples at the minimal additional cost. On the other
hand, it may deteriorate the importance sampling qual-
ity significantly. This happens because all samples with
potentially wildly different f(ωs
i,λj
i)values are traced,
and just one probability pΩ(ωs
i,λs
i)which matches the
shape of f(ωs
i,λs
i)only, is used. Whenever a direc-
tion ωs
iwith low probability pΩ(ωs
i,λs
i)is chosen at
random, and at least one of the f(ωs
i,λj
i)has a rela-
tively large value in that direction, the value is no longer
cancelled by the probability, leading to the excessively
high variance in the rendered image. Moreover, the esti-
mator (5) is incorrect whenever ∃λs
i,ωs
i:pΩ(ωs
i,λs
i) =
0 and ∃λj
i:f(ωs
i,λj
i)>0, particularly when a wave-
length dependent phenomenon is optically perfect, i.e.
its fis described by a δdistribution. Thus, the ini-
tial version of our new approach is not always better
than the traditional technique of tracing only one spec-
tral sample. The question is when the new technique
exhibits lower variance and when it does not.
5.3 Multiple Importance Sampling Esti-
mator
Fortunately, the variance issue can be solved automati-
cally. Simple modification of the estimator (5), which
incorporates Multiple Importance Sampling [19] (see
Appendix A), gives a better estimator with variance as
low as possible in a variety of conditions. The new im-
proved estimator is constructed from the estimator (5)
multiplying each cluster by Cand a weight Ws
iequal to:
Ws
i=pΩ(ωs
i,λs
i)
∑C
j=1pΩ(ωs
i,λj
i),(6)
where pΩ(ωs
i,λs
i)is the probability with which the scat-
tering direction is selected, and the values pΩ(ωs
i,λj
i)
are hypotethical probabilities of selecting the sampled
direction if using λj
ivalue instead. This leads to the
final estimator:
I≈1
NC
N
∑
i=1
CW s
i
pΩ(ωs
i,λs
i)·
·
C
∑
j=1
f(ωs
i,λj
i)w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i) =
=1
N
N
∑
i=1
1
∑C
j=1pΩ(ωi,λj
i)·
·
C
∑
j=1
f(ωs
i,λj
i)w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i).(7)
Assuming that a scattering model provides proper im-
portance sampling, the estimator (7) leads to a low
variance result. Moreover, the estimator (7) is cor-
rect whenever scattering model is correct, i.e. when-
ever ∀ω,λ:f(ω,λ)>0pΩ(ω,λ)>0, so it is appli-
cable even to optically perfect wavelength dependent
phenomena. However, in this case it does not provide
any benefit over estimator (4). The comparison between
the new estimators (5) and (7) and the previous sin-
gle sample estimator (4) is presented in Figure 3. The
glass sphere has linearly varying refraction from 1.35
for 360nm to 1.2 for 830nm and uses Phong based scat-
tering with n=1000. Images are created using only
two 16-sample clusters, to show error more clearly.
Figure 3: Comparison between new initial estimator
(left), new improved estimator (middle) and previous
method (right). The new initial estimator exhibits more
variance due to lack of proper importance sampling.
The color noise from single sample approach makes the
rightmost image barely legible.
5.4 Generation of Clusters
In order to generate clusters efficiently, two issues have
to be solved, namely: how many samples should a sin-
gle cluster contain, and how to generate them. The
number of spectral samples in a cluster is an important
decision for achieving best possible performance. Un-
fortunately, optimal number of such samples is highly
scene dependent. The more variation emission and re-
flectance spectra have, the more spectral samples a sin-
gle cluster should contain. Assuming that a scene con-
tains rather smoothly varying spectra (this assumption
Figure 4: Selection of optimal number of spectral samples for a single cluster: 4 samples (left), 8 samples (middle),
12 samples (right). All images were rendered in 640x480, with 200k image samples (i.e. spectral clusters).
typically is satisfied), it is possible to balance excessive
color noise and computational overhead. After a few
tests we have found that eight spectral samples are op-
timal1. Four samples cause significant noise and twelve
give barely visible improvement (see Figure 4). Ren-
dering time differences between these images have been
less than 1%, which confirms the efficiency of a cluster
approach.
The efficient generation of spectral samples proves to
be more difficult. Spectra should be importance sam-
pled, but there are at least three factors, which should
affect choice of pΛ, namely: sensor (camera, human
eye, etc.) sensitivity, light source spectral distribution
and reflectance properties of materials. However, of-
ten only sensor is taken into account, and it is assumed
that its sensitivity is well described by CIE yweighting
function. Unfortunately, despite producing good qual-
ity grayscale images, importance sampling wavelength
space with respect to the yfunction causes excessive
color noise, and, contrary to common knowledge, is
suboptimal. Ideally, a sampling probability should take
into account all three x,y, and zcomponents. After
some experiments, we found that following probability
gives good results:
pΛ(λ) = N−1fΛ(λ),fΛ(λ) = 1
cosh2(A(λ−B)),(8)
where A=0.0072nm−1and B=538.0nm are empiri-
cally evaluated constants and N=Rλmax
λmin fΛ(λ)dλis a
normalization factor. Results of this improved tech-
nique are presented in Figure 5.
Moreover, since spectra are typically smooth, sam-
pling them with quasi-Monte Carlo (QMC) low dis-
crepancy sequences instead of random numbers im-
proves results. However, care must be taken when
QMC sampling is applied to cluster based spectra.
When a wavelength dependent effect is to be simulated,
a single sample from the cluster has to be chosen. This
choice is tricky due to peculiarities of QMC sampling.
In case of true random numbers, selection of first sam-
1Due to Intel SSE instruction set optimization, our implementation re-
quires the number of samples to be divisible by four.
ple from a cluster always works correctly. On the other
hand, it is a serious error to select an every nth sample
from a low discrepancy sequence. In the latter case, we
assign a separate (pseudo)random sequence for a such
selection of a spectral sample, in addition to sequence
used for randomizing cluster samples. Results of QMC
sampling are presented in Figure 5.
Figure 5: Various methods of sampling spectra. Top
row: 2000K blackbody radiation. Bottom row: D65
spectrum. Left column: spectra sampled using random
numbers and our importance sampling, with various
numbers of samples. Middle column: comparison of
luminance based importance sampling (top halfs) with
our pΛ(bottom halfs) using 128 spectral samples. Right
column: spectra sampled using Sobol low discrepancy
sequence and our pΛ, using 4 and 8 spectral samples.
5.5 Results and Discussion
Some more comparison between single spectral sample
approach and improved technique is presented in Fig-
ure 6. Images in top row use previous settings (refrac-
tion coefficient from 1.35 for 360nm to 1.2 for 830nm
and glossiness coefficient n=1000). Next, images in
bottom row use much sharper settings (refraction coef-
ficient from 1.5 for 360nm to 1.2 for 830nm and glossi-
ness coefficient n=4000). Images from first and sec-
ond column are rendered to have approximately the
same quality, and images from second and third col-
umn are rendered with the same number of samples (i.e.
Figure 6: Imperfect refraction with dispersion. Top left
image uses previous approach with a massive number
of 900 samples per pixel. Top middle image uses new
technique with just 50 samples per pixel, yet it has sim-
ilar quality. Top right image again uses previous ap-
proach, but with 50 samples per pixel. However, gains
from using the new technique are less spectacular when
glossiness or dispersion is increased. Bottom row im-
ages use 900, 100, and 100 samples, respectively.
Settings CMIS SSS
n=1000
η= [1.35,1.20]
1 1.26 ·10−12.47 ·10−1
4 6.67 ·10−22.02 ·10−1
16 2.63 ·10−21.34 ·10−1
64 1.22 ·10−27.56 ·10−2
256 5.32 ·10−33.83 ·10−2
n=4000
η= [1.50,1.20]
1 2.07 ·10−12.46 ·10−1
4 1.33 ·10−11.96 ·10−1
16 7.39 ·10−21.29 ·10−1
64 3.84 ·10−27.37 ·10−2
256 1.74 ·10−23.72 ·10−2
Table 1: Comparison of error of our method (MIS) and
a single spectral sample approach (SSS), for C8-sample
spectral clusters per pixel. The error is evaluated as a
difference between the tested image and the reference
image, averaged over all pixels and color components.
The pixel values are normalized to [0,1]range.
traced rays). The average numerical error for various
numbers of rays for scene from Figure 6 is summarized
in Table 1.
Analysis of two limit cases could give more insight
into how this new technique works, and when it is most
effective. The analysis is based on the assumption that
f(ω,λ)∝pΩ(ω,λ)is roughly satisfied. Otherwise, the
multiple importance cannot help much in reducing vari-
ance. First, when wavelength dependence is negligible,
all the scattering probabilities become more and more
independent on λ:pΩ(ωs
i,λj
i)≈pΩ(ωs
i). The weight
Ws
ithen becomes:
Ws
i=pΩ(ωs
i,λs
i)
∑C
j=1pΩ(ωs
i,λj
i)≈pΩ(ωs
i)
∑C
j=1pΩ(ωs
i)→1
C,(9)
and the estimator:
I≈1
N
N
∑
i=1
Wi
pΩ(ωs
i,λs
i)·
·
C
∑
j=1
f(ωs
i,λj
i)w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i)→
→1
NC
N
∑
i=1
C
∑
j=1
f(ωs
i,λj
i)
pΩ(ωs
i)
w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i),(10)
which is an estimator of a simple, wavelength indepen-
dent, scattering. On the other hand, when scattering
becomes more and more glossy and wavelength depen-
dence is significant, with probability close to one the f
becomes close to zero for all directions except ωs
i. The
rare cases, when f(ωj
i,λj
i)is large and j6=s, have low
weight Ws
i, and therefore cannot affect the estimator
much. Moreover, all the probabilities but the selected
one go to zero, and therefore Wgoes to one, which
leads to estimator equal to:
I≈1
N
N
∑
i=1
Ws
i
pΩ(ωs
i,λs
i)·
·
C
∑
j=1
f(ωs
i,λj
i)w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i)→
→1
N
N
∑
i=1
f(ωs
i,λs
i)
pΩ(ωs
i,λs
i)
w(λj
i)
pΛ(λj
i)L(ωs
i,λj
i),(11)
which is equivalent to the one sample estimator. This
behaviour of estimator (7) is presented in Figure 7.
The former approach to spectral rendering separates
scattering into two cases: wavelength independent scat-
tering, and costly simulation of wavelength dependent
phenomena using single spectral sample estimator. On
the other hand, our method does not depend on such
classification. Due to automatically computed weights,
it adjusts itself to these two limit cases, and to the
broad spectrum of intermediate cases, when scattering
is wavelength dependent, but imperfect. The computa-
tional cost of our method depends on strength of wave-
length dependence and optical perfection of material.
These factors cause the cost to increase, but it never ex-
ceeds the cost of single spectral sample estimator.
6 SAMPLING OF LIGHT TRANSPORT
PATHS
In this section we describe an integration of our full
spectral sampling with selected light transport algo-
rithms – a case when there is more than one wave-
length dependent scattering encountered on the same
light path. The extension of single scattering approach
for Path Tracing [10] and Bidirectional Path Tracing
[19] is, however, obvious. The wavelength λs
iis se-
lected once for a whole path, and reused at each scat-
tering. The weight Ws
iis therefore computed for the
Figure 7: Analysis of behaviour of estimator (7) with increasing glossiness and wavelength dependence of scat-
tering. Wavelength independent scattering (leftmost image). Optically perfect wavelength dependent scattering
(rightmost image). Intermediate cases (middle). All the images are rendered with just four clusters.
whole path, using products of probabilities instead of
probabilities of single scatterings. Assuming that the
sampled path is build by recursively sampling fsand
tracing rays in sampled directions, the Ws
iis given by
the following expression:
Ws
i=∏m
k=1pΩ(ωs
ki,λs
i)
∑C
j=1∏m
k=1pΩ(ωs
ki,λj
i),(12)
where kis the number of a scattering event and mis the
length of the sampled path. Intuitively, a weight Ws
iis a
ratio of probability of generating the whole path using
selected wavelength λs
ito the sum of probabilities of
generating such a path using each wavelength from a
cluster. If a light transport algorithm generates a path
in a different way, or does not use a concept of light
transport paths, the weight Ws
ihas to be computed in a
different manner.
The notable case, where spectral sampling causes dif-
ficulties, is Jensen’s Photon Mapping, designed to work
with RGB triplets [8]. There are two issues: first, there
are no light transport paths, which connect light source
and camera, and second, millions of individual photons
have to be stored, causing excessive memory consump-
tion if full spectrum is used to describe them. A recent
work [11] addresses memory issues. Unfortunately, this
algorithm converts photons’ spectra to RGB prior to
storing them in a map, and converts RGB to spectra
again when searching through photons.
Our approach, on the other hand, is designed to con-
verge always to the true result with increased number
of photons, and therefore significant compression of
spectral data is unsuitable. We trace and store clus-
ters of photons with different wavelengths, instead of
describing them by RGB triplets. First, in order to
explore wavelength space properly, each emitted pho-
ton cluster must have individually chosen wavelengths.
The obvious place for optimization is that one emitted
photon cluster typically corresponds to several stored
photon clusters, and therefore cluster wavelengths are
stored once for each emission. Moreover, for storing
energy, one can experiment with a non-standard float-
ing point format instead of IEEE single precision. Us-
ing 8-sample clusters requires 32B of data for individ-
ual stored photon, not to mention an additional 32B for
Figure 8: Full spectral rendering of a non-trivial scene.
Dispersion is slightly exaggerated to render spectral
sampling quality more prominent.
each emission, which is far more than 12B required by
an RGB based implementation. If a compact float for-
mat with shared exponent is used, the latter can be com-
pressed even to 4B, however, with potential loss of im-
age quality. We have left this for further research.
When a photon is about to be stored, its energy is
multiplied by weight given by Equation (12), which ac-
counts for all encountered wavelength dependent scat-
tering events. In the second pass, rendering of photon
map is performed. Camera rays should be weighted
similarly prior to photon map lookups. In the classic
Photon Mapping, photons are searched in a sphere cen-
tered around the intersection point. The sphere radius
should be chosen carefully: too small causes noise and
too large – blurriness. We extend this approach to wave-
length search as well. If a photon cluster is decided to
be used in a flux estimate by a sphere test, additional
tests are performed on individual photons (with associ-
ated wavelengths) using a spectral search distance in a
wavelength space. Similarly as with the spatial radius,
the spectral distance must be chosen carefully.
7 CONCLUSIONS
We have presented an improved approach to full spec-
tral rendering. Full spectral algorithms realize a model
which is necessary to achieve physically plausible il-
lumination in 3D scenes. The result image rendered
with proposed spectral sampling, extended Walter et al.
microfacet refraction [20], and Bidirectional Path Trac-
ing is presented in Figure 8. The computational cost of
a full spectral simulation in comparison with an RGB
model is significant only for simple scenes containing
few primitives. The computational complexity of ray
tracing typically is logarithmic with respect to the num-
ber of primitives, and independent of a color represen-
tation. Therefore, when a scene becomes sufficiently
complex, the overhead of a physically correct algorithm
becomes negligibly small. On the other hand, the mem-
ory overhead depends on a particular algorithm. It is
negligible for Path Tracing and Bidirectional Path Trac-
ing, but is substantial for Photon Mapping.
A MONTE CARLO ESTIMATORS
This section briefly describes Importance and Multiple
Importance Sampling methods. Consult [6] and [19],
for more details. Let Ibe the integral to evaluate:
I=ZΨ
f(x)dµ(x).(13)
The basic Monte Carlo estimator of this integral is:
˜
I≈FN=1
N
N
∑
i=1
f(Xi)
p(Xi),(14)
where ∀x:f(x)6=0p(x)>0.
A variance of estimator (14) usually can be decreased
if the pis made near proportional to f, or at least to a
part of it. This technique is called Importance Sam-
pling. Particularly, when p∝f, the variance is zero.
However, to obtain normalization constant, fmust be
integrated analytically. This is impossible, otherwise
Monte Carlo integration would not be necessary.
Suppose that there are ipotentially good probability
densities pifor sampling f. If Importance Sampling is
used, the piused for sampling f(x)has to be chosen at
algorithm design time. This can have disastrous conse-
quences, if the pipoorly matches the actual f(x)shape.
In this case, Importance Sampling can actually increase
variance over sampling with uniform probability. How-
ever, Multiple Importance Sampling [19] has been de-
signed to improve the Importance Sampling when the
appropriate picannot be chosen at the design time. The
algorithm samples from each of these piand calculates
the final estimator as a weighted sum of these samples:
˜
I=
n
∑
i=1
1
m
m
∑
j=1
wi(Xi j)f(Xi j )
pi(Xi j),∀x
n
∑
i=1
wi(x) = 1.(15)
The appropriate choice of weights wi:
wi(x) = pi(x)
∑n
j=1pj(x)(16)
is crucial for obtaining low variance results.
REFERENCES
[1] Kate Devlin, Alan Chalmers, Alexander Wilkie, and Werner
Purgathofer. Tone reproduction and physically based spectral
rendering. In State of the Art Reports, Eurographics 2002,
pages 101–123, September 2002.
[2] Weiming Dong. Rendering Optical Effects Based on Spectra
Representation in Complex Scenes. In Computer Graphics In-
ternational, pages 719–726, 2006.
[3] Roman Durikovic and R. Kimura. GPU Rendering of the Thin
Film on Paints with Full Spectrum. In Proceedings of the IEEE
Conference on Information Visualization, pages 751–756, 2006.
[4] Glenn F. Evans and Michael D. McCool. Stratified wavelength
clusters for efficient spectral monte carlo rendering. In Graphics
Interface, pages 42–49, 1999.
[5] Randima Fernando and Mark J. Kilgard. The Cg Tutorial:
The Definitive Guide to Programmable Real-Time Graphics.
Addison-Wesley, Boston, MA, USA, 2003.
[6] George S. Fishman. Monte Carlo: Concepts, Algorithms and
Applications. Springer-Verlag, New York, USA, 1999.
[7] Jay S. Gondek, Gary W. Meyer, and Jonathan G. Newman.
Wavelength dependent reflectance functions. In SIGGRAPH
1994 Proceedings, volume 28, pages 213–220, 1994.
[8] Henrik Wann Jensen. Realistic image synthesis using photon
mapping. A. K. Peters, Ltd., Natick, MA, USA, 2001.
[9] Garrett M. Johnson and Mark D. Fairchild. Full-spectral
color calculations in realistic image synthesis. IEEE Computer
Graphics and Applications, 19(4):47–53, 1999.
[10] James T. Kajiya. The rendering equation. In SIGGRAPH 1986
Proceedings, pages 143–150, New York, NY, USA, 1986.
[11] Gorm Lai and Niels Jorgen Christensen. A compression method
for spectral photon map rendering. In WSCG 2007 Proceedings,
pages 95–102, 2007.
[12] Mark S. Peercy. Linear color representations for full spectral
rendering. In SIGGRAPH 1993 Proceedings, volume 27, pages
191–198, 1993.
[13] Bui Tuong Phong. Illumination for computer generated pic-
tures. Communications of the ACM, 18(6):311–317, 1975.
[14] Gilles Rougeron and Bernard Peroche. An adaptive represen-
tation of spectral data for reflectance computations. In EGRW
1997 Proceedings, pages 127–138, 1997.
[15] Jos Stam. Diffraction shaders. In SIGGRAPH 1999 Pro-
ceedings, pages 101–110, New York, NY, USA, 1999. ACM
Press/Addison-Wesley Publishing Co.
[16] Maureen Stone. A Field Guide to Digital Color. AK Peters,
Natick, MA, USA, 2003.
[17] Yinlong Sun, David F. Fracchia, Mark S. Drew, and Thomas W.
Calvert. Rendering iridescent colors of optical disks. In EGRW
2000 Proceedings, pages 341–352, 2000.
[18] Yinlong Sun, David F. Fracchia, Mark S. Drew, and Thomas W.
Calvert. A spectrally based framework for realistic image syn-
thesis. The Visual Computer, 17(7):429–444, 2001.
[19] Eric Veach and L. J. Guibas. Optimally combining sampling
techniques for monte carlo rendering. In SIGGRAPH 1995 Pro-
ceedings, pages 419–428, 1995.
[20] Bruce Walter, Stephen R. Marschner, Hongsong Li, and Ken-
neth E. Torrance. Microfacet Models for Refraction through
Rough Surfaces. In Eurographics Symposium on Rendering,
pages 195–206, Grenoble, France, 2007.
[21] Gregory J. Ward and Elena Eydelberg-Vileshin. Picture Perfect
RGB Rendering Using Spectral Prefiltering and Sharp Color
Primaries. In EGRW 2002 Proceedings, pages 117–124, 2002.
[22] A. Wilkie, R. Tobler, and W. Purgathofer. Raytracing of Dis-
persion Effects in Transparent Materials. In WSCG 2000 Con-
ference Proceedings, 2000.




















