Content uploaded by Manuel N. Gamito

Author content

All content in this area was uploaded by Manuel N. Gamito on Jun 01, 2016

Content may be subject to copyright.

Eurographics Symposium on Rendering 2016

E. Eisemann and E. Fiume

(Guest Editors)

Volume 35 (2016), Number 4

Solid Angle Sampling of Disk and Cylinder Lights

Manuel N. Gamito

Framestore, London, UK

Figure 1: The illumination from a cylinder light, sampled uniformly within its solid angle (above left) and within its area (below left), with 9

samples per pixel. Only the cylinder sectors visible from each illumination point have been sampled by area. The insets show the increase in

sampling quality to be progressively greater, the closer the illuminated surface is to the light.

Abstract

A new unbiased sampling approach is presented, which allows the direct illumination from disk and cylinder light sources to be

sampled with a uniform probability distribution within their solid angles, as seen from each illuminated point. This approach

applies to any form of global illumination path tracing algorithm (forward or bidirectional), where the direct illumination

integral from light sources needs to be estimated. We show that taking samples based on the solid angle of these two light

sources leads to improved estimates and reduced variance of the Monte Carlo integral for direct illumination. This work follows

from previously known unbiased methods for the solid angle sampling of triangular and rectangular light sources and extends

the class of lights that can be rendered with these improved sampling algorithms.

Categories and Subject Descriptors (according to ACM CCS): I.3.7 [Computer Graphics]: Three-Dimensional Graphics and

Realism—Raytracing

1. Introduction

The computation of the direct illumination from a light source on

the reﬂecting surface of objects is a fundamental part of the solu-

tion of the rendering equation [Kaj86]. All modern image render-

ers, commonly used in the ﬁlm production industry, use the path

integral formulation of this rendering equation to compute the light

transport in complex scenes [Vea97]. It is therefore important to

solve the direct illumination integral efﬁciently and with good qual-

ity for any surface point.

For lights that have a Dirac delta distribution (such as point and

spot lights), the illumination integral has a simple analytical so-

lution. For area lights, however, the computation of the direct il-

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John

Wiley & Sons Ltd. Published by John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

lumination requires a numerical integration over some appropriate

space. Traditionally, this has been done by distributing point sam-

ples uniformly over the area of the light and using them as part of

a Monte Carlo integration [PH10]. Additional work has shown that

distributing directional samples over the solid angle of an area light,

relative to each illumination point, leads to better Monte Carlo es-

timates, while keeping the algorithm unbiased (see example in Fig-

ure 1). This new solid angle sampling approach has, so far, been

restricted to area lights that are either spherical, triangular or rect-

angular [Wan92,Arv95,UFK13].

In this paper, we extend solid angle sampling to two more

area lights that ﬁnd use in ﬁlm production: disk lights and cylin-

der lights. Although rectangular lights (commonly known as quad

lights) are arguably the most ubiquitous area lights in production

scenes, together with HDRI environments, there are still lighting

situations for which disks or cylinders are best suited. It is de-

sirable, therefore, to extend the solid angle formulation, with its

proven convergence qualities, to as many light types as possible.

Central to the solid angle sampling of any ﬁnite area light is the

ability to express its solid angle in analytic form. We present the

solid angle formulae for disks and cylinders, as taken from the sci-

entiﬁc literature. The common element between these two geome-

tries is that their solid angle requires the evaluation of elliptic inte-

gral functions [AS70]. The next step would be the construction of

a mapping from the space [0,1)2of two-dimensional random num-

bers to the solid angle space of the object, such that equal areas in

[0,1)2map to subsets of the solid angle that have equal measure.

Unfortunately, the integral function formulation for disks and cylin-

ders makes the derivation of such a mapping problematic. We rely

instead on a rejection sampling approach, where the geometries of

interest are bound by simpler objects for which a parameterisation

of their solid angle is available. This rejection sampling technique

remains unbiased and we show that it is efﬁcient, with only a small

number of trial samples being rejected, due to the tightness with

which the intended solid angles can be bound.

2. Background and Previous Work

The direct illumination integral from an area light source can be

expressed in the following way, relative to a point x, with normal

n, on the surface of an object (Figure 2):

L(x,ω

ω

ωo) = L0ZΩ

f(x,ω

ω

ωo,ω

ω

ωi)G(x,ω

ω

ωi)|n·ω

ω

ωi|dω

ω

ωi.(1)

In the above, L0is the constant emission of the light source, Ω

is the solid angle of the light, as seen from x,fis the surface bidi-

rectional reﬂectance distribution function (BRDF) and G∈ {0,1}

is the binary geometric visibility function on x, along the incoming

direction ω

ω

ωi. The illumination depends on the outgoing direction

ω

ω

ωoonly through the surface’s BRDF.

Since sampling the solid angle Ωis generally considered difﬁ-

cult, a change of variables leads to an alternative formulation of the

illumination integral, where the integration takes place instead over

the area of the source:

L(x,ω

ω

ωo) = L0ZA

f(x,ω

ω

ωo,ω

ω

ωi)G(x,ω

ω

ωi)|n·ω

ω

ωi||m·ω

ω

ωi|

ky−xk2dy.(2)

Ω

A

x

y

ω

ω

ωi

ω

ω

ωon

m

Figure 2: The direct illumination from an area light.

After this change, Ais the area of the light source that is visible

from xand the integration is performed over points y, with normal

m, on the light. The incoming direction at xis now the direction

towards y:ω

ω

ωi= (y−x)/ky−xk.

The two integrals return the illumination from a single light

source but it is possible to work in a multi-light environment by

randomly selecting a light for integration, out of the full light set

[SWZ96]. Both integrals can be solved with Monte Carlo integra-

tion in the usual way. In the case of (2), area samples yare taken

according to a uniform probability density pA(y) = 1/|A|. In the

case of (1), directional samples ω

ω

ωiare taken according to the prob-

ability density:

pΩ(ω

ω

ωi) = (1/|Ω|if ω

ω

ωi∈Ω,

0 otherwise.(3)

The use of stratiﬁed samples is desirable, in order to reduce the

variance of the Monte Carlo integrals. Stratiﬁcation is achieved if

the mapping from the stratiﬁed random numbers in [0,1)2to the

domain being sampled is a bijection. Algorithms for the stratiﬁed

sampling of areas are available for many objects such as spheres,

cylinders, disks and triangles [Tur90,SWZ96,SC97]. The sampling

of rectangular polygons is trivial and an algorithm for sampling

general convex quadrilaterals is also known [AN07].

An algorithm for sampling cylinder lights, that is intermediate

between area and solid angle sampling, is possible [Zim95]. The

cylindrical surface is parameterised by (θ,h), where θis the angle

around the cylinder axis and his the axial distance, and each of

these is sampled independently. Contrary to area sampling (where

sampling along θand hwould follow uniform probability distribu-

tions), importance sampling is performed for each of the two pa-

rameters, using probability distributions that depend on the conﬁg-

uration of the cylinder, relative to the illumination point.

Stratiﬁed sampling in the solid angle domain is easily done

for spheres [Wan92]. Triangles, whose solid angle projection to

the unit sphere leads to spherical triangles, can also be sampled

[Arv95]. This is an important result because it allows the solid an-

gle sampling of any general polygon mesh: the mesh is triangu-

lated, a spherical triangle is then randomly chosen, with a prob-

ability proportional to its individual solid angle, and this is then

sampled. The only drawback is that the initial triangle selection

step breaks the overall sample stratiﬁcation — stratiﬁcation is only

possible inside each individual triangle, once it has been chosen.

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

A bijection that allows the stratiﬁed sampling of spherical rect-

angles has been presented [UFK13]. This contribution successfully

showed the advantage of sampling a rectangular light directly, in-

stead of decomposing it into two spherical triangles, which allows

the stratiﬁcation to be preserved across the whole light source and

leads to a decrease in the integral estimator variance. In this pa-

per, we use spherical rectangles as the bounding object for the light

sources that we are interested in sampling.

A technique for solid angle sampling of light sources, that

has some similarities to ours, has previously been developed

[TWCC06]. This technique surrounds the light source with a

bounding mesh and samples that mesh, using the aforementioned

algorithms for spherical triangles. The technique, however, is bi-

ased — it is the illumination from the bounding mesh that is actu-

ally computed and not from the original light source. The bias can

be reduced (but not eliminated) by subdividing the mesh into many

ﬁner polygons, making the method more expensive.

Orthogonal to our work, methods that model the illumina-

tion distribution from complex light ﬁxtures have been developed

[KHM09,VADWG15]. These attempt to describe the transport of

light through several layers of reﬂective and refractive surfaces that

surround the light source. An approximate sampling method for

cylinders, which uses a piecewise linear probability density func-

tion, has been proposed to describe the indirect scattering from

volumes [NNDJ12]. Ray segments inside a volume are spatially

blurred and become cylinders, thus removing a source of singular-

ities from the sampling.

Recently, an analytic solution for the direct illumination from

polygonal mesh lights onto a class of BRDFs, designated as Lin-

early Transformed Cosines, has been presented [HJSD16]. Such

BRDFs are generated from a cosine-weighted hemisphere, which

has been transformed by a matrix that accounts for such linear ef-

fects as rotation, anisotropic scaling and shearing.

3. Sampling Disk and Cylinder Lights

The solid angle sampling of disk and cylinders proceeds in an iden-

tical manner and, in its most basic form, can be expressed in Algo-

rithm 1. It takes the geometry Lof the light source and the point

xfor which illumination is required. It returns a direction ω

ω

ωiand a

probability density pi.

Algorithm 1 Sampling of Disks and Cylinders

Require: point x, light L,return direction ω

ω

ωi, PDF pi

Ω←solid angle of L,as seen from x

R ← spherical rectangle bounding L,as seen from x

repeat

(ξ1,ξ2)←random numbers ∈[0,1)2

ω

ω

ωi←sample R(ξ1,ξ2)See [UFK13]

until {x,ω

ω

ωi}intersects L

pi←1/Ω

The algorithm repeatedly tries directions, generated towards the

spherical rectangle, until the semi-inﬁnite ray, with origin at xand

direction ω

ω

ωi, intersects the light source. In what follows, we ﬁrst

P

O

l

Rd

r1r0

φ

Figure 3: The solid angle of a disk, seen from P.

consider the case of a disk light, due to its simplicity, followed by

the cylinder light. For each light, we begin by presenting the solid

angle formula, relative to x, and proceed with the placement of the

bounding spherical rectangle R.

3.1. Disk Lights

We consider a disk light to have a front and a back face, with only

the front face providing illumination. The formula for the solid an-

gle of a disk of radius Ris derived in [Pax59], for a point Pat a

distance lfrom the plane of the disk and a distance dalong the

plane of the disk (see Figure 3):

Ω=

−2l

r1K(k)−πΛ0(φ,k) + 2πif d<R,

−2l

r1K(k) + πif d=R,

−2l

r1K(k) + πΛo(φ,k)if d>R,

(4)

r2

1=l2+ (d+R)2,

r2

0=l2+ (d−R)2,

k=1−r2

0/r2

1,

φ=arcsin l

r0.

In this equation, K(k)is the complete elliptic integral of the ﬁrst

kind and Λo(φ,k)is the Heuman lambda function [AS70]. The con-

tinuity between the three cases of d, relative to R, is ensured by the

fact that Λ0(π/2,k) = 1.

3.1.1. Bounding the Disk Light

The spherical rectangle R, in solid angle space, that is used to

bound Ω, corresponds to a square of side 2R, embedded in the plane

of the disk (see Figure 4). The square is oriented along the axis from

Q, the projection of Ponto the plane, to the centre of the disk at O.

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

P

d

l

OQ

R

Figure 4: A square bounding the disk.

This orientation is important, in the case d>R, because it ensures

that Qis always outside the square. If this were not so and Pwas

too close to the plane (a small lin Figure 4), there would be an

excessive number of trial directions ω

ω

ωithat would not intersect the

disk. For d<R, the problem does not occur, since Pprojects inside

both the square and the disk, but we maintain the same orientation

for consistency.

3.2. Cylinder Lights

The formula for the solid angle Ωof a cylinder of radius Rand

height Hcan be found in [Try12]. The value of Ωis computed in

a local coordinate system (see Figure 5) where the point Pis at

a distance dfrom the cylinder axis and the base of the cylinder

is offset by a distance h0from the XY plane. We always consider

d>Rbecause cylinder lights do not illuminate their interiors. The

solid angle is the composite of three smaller solid angles Ω1,Ω2

and Ω3, corresponding to the surfaces S1,S2and S3in Figure 5:

Ω=Ω1+Ω2−sgn(h0)Ω3.(5)

The central axial region contributes Ω1to the total. The upper

end cap adds Ω2to this contribution. The lower end cap subtracts

Ω3from the total if the cylinder is above the XY plane (h0>0),

otherwise it adds Ω3to the total when the cylinder extends below

the plane (h0<0). The values for Ω2and Ω3can be computed from

a single formula ΩC(h)for a cylindrical cap, parameterised by the

height halong the Zaxis:

ΩC(h) = 4R

q(d−R)2+h2nΠ(n1,φ|m)−Π(n0,φ|m)o,(6)

n1=h+i(d+R)

h+i(d−R),

n0=(d+R) + ih

(d−R) + ih ,

φ=iarcsinhrd−R

d+R,

m=(d+R)2+h2

(d−R)2+h2.

We then have Ω2=ΩC(h0+H)and Ω3=ΩC(h0). The func-

tion Π(n,φ|m)is the incomplete elliptic integral of the third kind

[AS70]. Details of how equation (6) is evaluated are given in the

Appendix .

h0

c

S2

S3

S1

x

y

z

P

R

H

d

b

Figure 5: The solid angle of a cylinder, expressed in a local coor-

dinate system centered at P.

The value of Ω1is the solid angle of a rectangle, oriented relative

to the coordinate axes as shown in Figure 5:

Ω1=2arctan c(h0+H)

bqb2+c2+ (h0+H)2−

2arctan ch0

bqb2+c2+h2

0

,

(7)

b=d1−(R/d)2,c=Rq1−(R/d)2.

Each of the two terms in (7) is the solid angle of a rectangle that

starts at the height h=0 on the plane. Their difference gives the

desired result for the rectangle from h0to h0+H.

3.2.1. Bounding the Cylinder Light

The cylinder light can be bounded by a rectangle shape Sthat is

very similar to the rectangle S1of Figure 5. To make sure that the

end cap S2is also sampled, the bounding rectangle needs to have its

upper height increased by a sufﬁcient amount. Figure 6shows this

bounding rectangle. The range of heights for Sis [h0,h1], where

h1can be obtained trigonometrically and with a simple algebraic

manipulation:

h1= (1+R/d)(h0+H).(8)

Note that h0+H<h162(h0+H), given that d>R, so the

bounding rectangle will, at most, be twice as high as the cylin-

der. If the cylinder intersects the XY plane (h0<0), we also ex-

tend Sdownwards, along the −Zaxis, by the negative amount

(1+R/d)h0. Similarly to the upper end cap, the downwards ex-

tension is bounded by 2|h0|in absolute value. The rectangle Sbe-

comes, in solid angle space, the spherical rectangle Rthat provides

an optimal bound for the solid angle Ωof the cylinder.

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

h0

h1

c

S

x

y

z

P

R

H

d

b

Figure 6: The bounding rectangle S of a cylinder, with a height h1

that extends above h0+H.

3.2.2. Clipping the Cylinder Light

The illumination integral (1) is clamped by the cosine term |n·ω

ω

ωi|.

Any attempt to sample an incoming direction ω

ω

ωifor which (n·

ω

ω

ωi)<0 represents a wasted computational effort and increases the

noise in the integral estimate. For some conﬁgurations of a cylinder

light, relative to a surface point P, with normal N, it is possible to

clip the cylinder against the surface tangent plane so as to minimise

the number of light samples taken from below that plane.

Since a general formula for the solid angle of a clipped disk is

not known, the clipping of a cylinder light is only possible when the

surface plane does not intersect the cylinder caps. If the cylinder is

long and thin, with an aspect ratio H/R1, then any intersecting

plane is much more likely to clip the cylinder geometry without

touching any of the end caps, which makes the clipping procedure

very effective. If, on the other hand, the cylinder is short and wide

(H/R1) then clipping is almost certainly not possible and the

sampling of the light proceeds without taking this step.

To clip the cylinder light before sampling, we ﬁnd the intersec-

tion of the central rectangular surface S1with the tangent plane

(see Figure 7) and work with the smaller surface S0

1⊂S1above the

plane, with a solid angle Ω0

1<Ω1. Let {ha,hb} ∈ [h0,h0+H]be

the two heights where the surface plane clips S1, such that ha6hb.

Also let Nzbe the vertical component of the plane’s normal vec-

tor N. After clipping, we can obtain the total solid angle Ωof the

cylinder and the height range [hA,hB]of the clipped surface S0

1, ac-

cording to Algorithm 2.

For simplicity, we ignore the general trapezoidal shape of S0

1and

treat it instead as a rectangle, by taking either the maximum or the

minimum of {ha,hb}, depending on the sign of Nz(refer to Algo-

rithm 2and Figure 7). It would have been possible to improve the

clipping and further reduce the number of discarded samples by

h0

c

S0

1

x

y

z

N

P

R

H

ha

hb

d

b

Figure 7: The clipping of a cylinder by an upward-facing plane

passing at P, with normal N.

Algorithm 2 Clipping of Cylinders

Require: ha,hb,return Ωand [hA,hB]

[hA,hB]←[h0,h0+H]Initialise clipped range

if Nz>0 & ha>(1+sgn(h0)(R/d))h0then

hA←haClip lower cap

Ω←Ω0

1+Ω2

else if Nz<0 & hb<(1−R/d)(h0+H)then

hB←hbClip upper cap

Ω←Ω0

1−sgn(h0)Ω3

else No clipping was possible

Ω=Ω1+Ω2−sgn(h0)Ω3Equation (5)

end if

evaluating the solid angle of the correct S0

1trapezoid, at the cost

of a more complex clipping algorithm. The clipped solid angle Ω0

1

has an expression similar to equation (7) but using instead the hA

and hBheights. If the clipping is not effected, the total solid angle

remains that of equation (5) and the height range for S0

1is the same

as for S1, effectively making S0

1=S1.

The clipped rectangle S0

1is extended into a bounding rectangle

S0by multiplying its height range [hA,hB]with the same factor

(1+R/d)used in Section 3.2.1, based on the following rules: hBis

multiplied only if it is equal to h0+Hand hAis multiplied only if

it is negative and equal to h0. In other words, only an extreme of S0

1

that corresponds to the height of one of the original cylinder caps

is extended to form the bounding rectangle, while an extreme that

results from the clipping procedure stays unchanged.

4. Implementation

As with any rejection sampling method, some care is required to

ensure that it does not become locked in an inﬁnite loop, end-

lessly testing trial samples. In our case, this can happen for very

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

small solid angles, as when a disk light is seen almost edgeways

from some surface point. The spherical rectangle sampling algo-

rithm is sensitive to numerical errors for small solid angles and this

can cause the sampled directions never to intersect the light, even

though the spherical rectangle correctly bounds the solid angle of

the latter.

We avoid inﬁnite loops in a two-fold way. Firstly, we skip rejec-

tion sampling entirely if the solid angle Ωof the light is smaller

than some value ΩMIN . Secondly, we break out of the sampling

loop after a maximum number of iterations NMAX . If either of these

two conditions is reached, we fall back to using the conventional

area sampling method for disks or cylinders. This ensures that not

only are lockups avoided but also that the lighting integral esti-

mator remains unbiased, even for those surface points where the

solid angle sampling algorithm fails. In our implementation, we

use ΩMIN =0.001 steradians and NMAX =100 iterations.

A second issue brought about by rejection sampling is that strati-

ﬁed sampling is not possible, because the mapping of random num-

bers from the [0,1)2domain to Ωis no longer a bijection. Not all

values in the unit square map to a valid direction in Ωand this could

lead to a situation where the attempt to take a random number pair

in a stratum of [0,1)2would repeatedly fail, if that stratum maps to

a solid angle that is completely outside of the solid angle Ωof the

light.

Since stratiﬁed random numbers cannot be used, we rely instead

on low discrepancy sequences. These are inﬁnite deterministic se-

quences of numbers that are known to be well distributed within the

unit square domain [PH10]. A low discrepancy sequence generates

the quasi-random numbers that drive the rejection sampling algo-

rithm. In this respect, the algorithm can be considered as a form of

deterministic rejection sampling [Wan00]. We use the implementa-

tion of a lattice sampler for our number generator [CKN06].

If desired, the proposed algorithm can be optimised by replac-

ing the numerical evaluation of the elliptic integrals with tabulated

functions, at the cost of introducing bias. More details about the

tabulation of the elliptic integrals, used by disk and cylinder lights,

is given in the Appendix.

The algorithm was developed as a plugin for the Arnold path

tracer [KFC∗10]. This is a fully multi-threaded path tracing so-

lution that allows customisable surface shaders to be written. For

every ray-surface intersection, our surface shaders invoke our own

light sampling functionality, thus bypassing the native light sam-

pling done by Arnold.

5. Results

Figure 8shows the illumination from two back-to-back disk lights.

For clarity, the lights themselves are invisible, to enable a bet-

ter viewing of the surface illumination. The two lights have been

placed vertically and touch the horizontal surface at their lower ex-

tremities. The results are visibly smoother with solid angle sam-

pling. The difference heatmaps, obtained against a ground truth so-

lution, also show that solid angle sampling achieves better conver-

gence for the same number of samples, particularly at short dis-

tances to the lights.

(a) Area sampling. (b) Solid angle sampling.

Figure 8: Disk light illumination on surfaces (top row). The lower

row shows the colour coded difference of the two techniques to a

ground truth image (9 samples per pixel).

The algorithm for cylinder lights has been tested against area

sampling and against an improved version of the cylinder sam-

pling algorithm of [Zim95], which is here called Zimmerman Sam-

pling. The improved algorithm replaces the importance sampling

for the height halong the cylinder axis with equi-angular sam-

pling [KF12]. This is a better technique, which was not available

at the time of the original contribution, that takes samples along a

line segment such that the angle, relative to the illumination point,

has a uniform distribution.

Figure 9shows the results of cylinder light sampling with the

three algorithms, for a cylinder on top of the horizontal plane.

There is an improvement from area sampling to Zimmerman sam-

pling and then to solid angle sampling. The different heatmaps also

make this improvement clear. Zimmerman sampling takes sam-

ples independently on the (θ,h)parametric domain of the cylin-

der and this leads to a solid angle probability density of pΩ(ω

ω

ω) =

pΘ(θ)pH(h)/|J(θ,h)|, where pΘand pHare the independent distri-

butions for each parameter and J(θ,h)is the Jacobian of the trans-

formation from (θ,h) space to solid angle space. Although pΘand

pHare optimal, in their own sub-domains, their product with the

inverse Jacobian isn’t and leads to a solid angle probability density

that is not uniform. Solid angle sampling overcomes this problem

by taking samples directly in the solid angle space Ωof the light

with the uniform probability density function pΩ(ω

ω

ω).

The implementation of Multiple Importance Sampling (MIS) is

straightforward for the proposed algorithms [VG95]. When sam-

pling the incoming direction from the light, the corresponding

BRDF sampling probability is used for MIS weighting. When

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

(a) Area sampling. (b) Zimmerman sampling. (c) Solid angle sampling.

Figure 9: Cylinder light illumination on surfaces (top row). The lower row shows the colour coded difference of the three techniques to a

ground truth image (9 samples per pixel).

sampling the incoming direction from the surface BRDF, the cor-

responding light sampling probability, for the purpose of MIS

weighting, is the inverse of the solid angle (3). Figure 10 shows

the results for cylinder sampling with MIS. Thanks to the BRDF

sampling component of MIS, the sampling noise is reduced along

the ground plane, where it touches the cylinder light, relative to the

results of Figure 9. The improvement is more signiﬁcant for area

sampling and Zimmerman sampling and less noticeable for solid

angle sampling, which indicates that the latter is already providing

good quality sampling results at close distances to the light.

Figure 11 tests the clipping of a cylinder light that takes place

before sampling. The cylinder is vertical and intersects the ground

plane in such a way that one half of the cylinder is above the plane

and the other half is below. By clipping the light, no light sam-

ples are taken from below the plane, thereby improving the render

quality. For this scene, the rendered result is the same as that for a

cylinder light that has only half the height of the original and rests

above the plane.

The convergence curves, including the implementation of MIS,

are shown in Figure 12, in terms of root mean square error against

a ground truth image. Solid angle sampling converges faster than

area sampling. Zimmerman sampling, in the case of cylinder lights,

shows intermediate convergence. The ground truth was rendered

with 1024 samples per pixel and 10 samples per surface point.

The proposed algorithms can also be applied to light sampling

in volumes. The lighting integral for a point xin a volume is very

similar to that for surfaces, with the surface BRDF being replaced

with the volume phase function p(x,ω

ω

ωo,ω

ω

ωi):

L(x,ω

ω

ωo) = σsL0e−RTσtdt ZΩ

p(x,ω

ω

ωo,ω

ω

ωi)V(x,ω

ω

ωi)dω

ω

ωi

=σsL0e−RTσtdt ZA

p(x,ω

ω

ωo,ω

ω

ωi)V(x,ω

ω

ωi)|m·ω

ω

ωi|

ky−xk2dy.(9)

The constant σsis the scattering coefﬁcient of the volume.

The visibility function V(x,ω

ω

ωi)∈[0,1]now includes attenuation

through the volume. The illumination L(x,ω

ω

ωo)is attenuated by the

factor e−RTσtdt , where Tis the distance travelled along ω

ω

ωoand σt

is the, potentially varying, extinction coefﬁcient of the volume. Fig-

ure 13 shows volume rendering results with both disk and cylinder

lights. Similar to the surface rendering results, render quality is im-

proved with solid angle sampling and particularly when the volume

is close to the light source.

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

(a) Area sampling. (b) Zimmerman sampling. (c) Solid angle sampling.

Figure 10: Cylinder light illumination on surfaces with Multiple Importance Sampling (top row). The lower row shows the colour coded

difference of the three techniques to a ground truth image (9 samples per pixel).

Figure 11: A vertical cylinder light, intersecting the ground plane,

without clipping (left) and with clipping (right).

The acceptance rate of trial samples is shown in Table 1for both

types of light sources and for surface and volume rendering. These

statistics are based on the previously shown images that were ren-

dered at 512 ×512 resolution. The acceptance rate for a disk light

matches well with the π/4 area ratio of a disk inscribed in a square,

as should be expected.

The acceptance rate for the cylinder lights is nearly optimal, with

every light sample almost always being accepted. The tested cylin-

ders have an aspect ratio H/Rof 40 for surface rendering and 15

for volume rendering. Such long cylinders have a solid angle that is

mostly dominated by the central spherical rectangle, with the end

caps having only a small contribution. In such cases, a trial sample

is most likely to fall on the rectangle and is immediately accepted.

The acceptance rate degrades for short cylinders, where the con-

tribution of the end caps to the solid angle is more important. We

have tested a cylinder with an aspect ratio of 0.1 and found the

acceptance rate to be 17.68%, or roughly 1 in every 5 trial sam-

ples. Fortunately, short cylinders are seldom needed in production

scenes, in contrast to long cylinders that are frequently used to rep-

resent ﬂuorescent lighting. In the limit, the acceptance rate would

drop to 0% as H/R→0. This is avoided, in practice, by the mech-

anism discussed in Section 4, whereby the algorithm switches to

uniform area sampling when the solid angle falls below a speciﬁed

threshold.

Table 1also shows the render times, obtained on a 8-core ma-

chine. The use of tabulated values for the elliptic integral functions

has a clear impact in lowering render times, especially for volume

rendering. Tabulation introduces bias, however, and this can be con-

trolled by the size of the function tables and by the table interpola-

tion scheme used. We have used sizes of 256 for K(k), 90 ×90 for

Λ0(k,φ)and 64 ×64 ×64 for Π(n,φ|m).

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

1 10 100 1,000

0.001

0.01

0.1

1

Samples per Pixel

RMSE

Disk Light

Area Sampling

Solid Angle Sampling

1 10 100 1,000

0.001

0.01

0.1

1

Samples per Pixel

RMSE

Cylinder Light

Area Sampling

Zimmerman Sampling

Solid Angle Sampling

Figure 12: Convergence for disk sampling (top) and cylinder sampling (bottom) with MIS, for increasing number of samples.

Render Time

Sample

Acceptance

Function

Evaluation

Function

Tabulation

Disk Surface (Fig. 8) 78.57% 3.55s 2.61s

Volume (Fig. 13) 78.81% 18.96s 9.16s

Cylinder Surface (Fig. 9) 97.24% 3.86s 2.97s

Volume (Fig. 13) 92.24% 19.40s 9.89s

Table 1: Rendering statistics.

Figure 14 shows a frame from a ﬁlm production where multiple

cylinder lights have been used to illuminate the interior of a space-

ship. This illustrates the use of the proposed algorithms in produc-

tion environments. Each light is assigned a sampling probability,

relative to each illumination point, with a simple heuristic that es-

timates the inﬂuence of the light to that point. A speciﬁc light is

then randomly selected and the light’s probability is used to scale

the solid angle probability density (3).

6. Future Work

The proposed sampling algorithm is quite general and can be used,

beyond disk and cylinder lights, to perform solid angle sampling of

any light geometry. The only two requirements are as follows:

•An analytical formula for the solid angle of the light must be

known.

•The light must be bounded by simpler geometries whose solid

angle can be sampled.

Bounding geometries can either be spheres, spherical rectangles

or preferably small sets of large spherical triangles, depending on

which can bound the geometry of the light more efﬁciently.

An example in mind is the sampling of a mesh light. Although

triangle meshes can already have their solid angle sampled, the

sampling is of poor quality if the mesh is made of many small

triangles, due to the loss of sample stratiﬁcation (refer to the dis-

cussion in Section 2). Bounding the mesh with a sphere or a few

large spherical triangles will improve the sampling quality. Solid

angle sampling, with this addition of mesh lights, could then be

performed on all the lights most commonly used for ﬁlm produc-

tion, leading to an overall improvement of rendering quality.

It would also be interesting to look at the solid angle sam-

pling of lights that have an emission texture. Such lights will no

longer be characterised by a single emission constant L0, as has

been done in this work. It is conjectured that importance sam-

pling of both the light texture and the light solid angle will require

combined sampling techniques such as MIS or importance resam-

pling [VG95,TCE05].

7. Conclusions

Sampling lights within their solid angle space, relative to an illumi-

nation point, is known to produce better results for global illumina-

tion rendering algorithms, with less noise and faster convergence,

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

(a) Area sampling. (b) Solid angle sampling.

Figure 13: Volume rendering results with a disk light (top) and a

cylinder light (bottom). Rendered with 9 samples per pixel and 8

samples per ray.

when compared against simpler area sampling algorithms. Such

solid angle sampling algorithms could only previously be applied to

a small number of production light geometries, namely spheres and

rectangles. We have extended this desirable class of algorithms to

include disks and cylinders. We have also suggested how the same

technique can be extended to triangular meshes, without the need

for an intermediate random triangle selection step that reduces the

quality of the sample distribution.

The proposed algorithms are unbiased and ﬁt easily into the di-

rect illumination calculation of any path tracer. The cost of evalu-

ating the elliptic integrals, present in the solid angle of disks and

cylinders, may justify implementing a biased version of the algo-

rithm that uses tabulated functions. We have also shown that the

rejection sampling nature of the algorithms is efﬁcient, with trial

samples that are very quickly accepted, due to a tight bounding of

the light’s solid angle with a spherical rectangle, with the only ex-

ception of pathological cases of cylinders that are short and broad.

An improvement to the sampling of lights would include the sur-

face cosine term in the probability distribution: a light would no

longer be sampled according to its solid angle but according to its

projected solid angle. Given that the solid angle formulae for disks

and cylinders are already complex and that equivalent projected

solid angle formulae are not known, it seems that solid angle sam-

pling is the best algorithm that can be implemented for these two

lights. This is in contrast to rectangular lights, where the projected

solid angle has the same expression of the point-to-polygon form

factor of the radiosity algorithm and for which a projected solid

angle sampling algorithm may be feasible in the future [CW93].

8. Acknowledgements

The author would like to thank Martin Preston and Nathan Walster

for providing the opportunities of performing research work in the

middle of an always busy production schedule. The author would

also like to thank Josh Bainbridge for implementing the low dis-

crepancy sampler that was used in this paper.

Appendix: Evaluating Elliptic Integral Functions

We evaluate the elliptic integrals K(k)and Λ0(k,φ), required by disk lights,

with numerical functions provided by the GNU Scientiﬁc Library (GSL)

[GSL16]. The Heuman Lambda function Λ0(k,φ)is evaluated in terms of

other elliptic integrals, although we have since found that Boost provides

a direct implementation [Boo16]. The two functions K(k)and Λ0(k,φ)can

be easily tabulated, given that 0 6k<1 and 0 6φ<π/2, and, in fact, such

tables are usually found in the literature [AS70].

For ease of reference, we repeat here the equations from Section 3.2 for

the solid angle of a cylinder cap of radius R, at a height hand along distance

dfrom the illumination point towards the axis of the cylinder:

ΩC(h) = 4R

q(d−R)2+h2nΠ(n1,φ|m)−Π(n0,φ|m)o,(A.1)

n1=h+i(d+R)

h+i(d−R),

n0=(d+R) + ih

(d−R) + ih ,

φ=iarcsinhsd−R

d+R,

m=(d+R)2+h2

(d−R)2+h2.

The difﬁculty with this integral function is that it has complex argu-

ments and numerical solutions for Π(n,φ|m)in the complex domain are not

easily available, unless commercial mathematics packages are used. The

value of ΩC(h)is real, nevertheless, because φis a pure imaginary number,

while n1and n0form a complex conjugate pair. This causes Π(n1,φ|m)and

Π(n0,φ|m)to have the same imaginary value and so their difference in (A.1)

cancels out. At the same time, the real parts of Π(n1,φ|m)and Π(n0,φ|m)

have the same absolute value and opposite signs. These symmetries indi-

cate that there is scope for simpliﬁcation in (A.1) and that a brute force

evaluation of two elliptic integrals with complex arguments is not required.

The best approach is to employ the deﬁnition of Π(n,φ|m)in (A.1), re-

place the expressions for the function parameters, change the integration

variable from the imaginary to the real line and perform some algebraic

simpliﬁcation, to arrive at the integral:

ΩC(h) = 16R2h

(d−R)2+h23/2

Z|φ|

0

sinh2ϕdϕ

1+2nsinh2ϕ+msinh4ϕp1+msinh2ϕ,

(A.2)

n=d2−R2+h2

(d−R)2+h2,

where the parameters φand mare as previously in (A.1). The value of ΩC(h)

can be evaluated, using a numerical integrator from the GSL. To tabulate

this function, we use a change of variables to write ΩC(u,v,w).

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

Figure 14: A spaceship interior from the ﬁlm The Martian, illustrating the use of several cylinder lights, among other types of light source,

to illuminate interior scenes (Copyright Twentieth Century Fox).

The new variables 0 6u,v,w<1 are such that:

u=sd−R

d+R,

v=s(d−R)2+h2

(d2−R2) + h2,

w=s(d−R)2+h2

(d+R)2+h2,

(A.3)

and consequently:

|φ|=arcsinhu,

n=1/v2,

m=1/w2.

(A.4)

A table for ΩC(u,v,w)can be built by evaluating (A.2) for triples in the

[0,1)3domain. The choice of square roots for vand wwas found to be

desirable because it removes the quadratic distortion in those parameters

and spreads the values of Ωc(u,v,w)more uniformly within its domain.

References

[AN07] ARVO J., NOV INS K.: Stratiﬁed sampling of convex quadrilat-

erals. Journal of Graphics, GPU, and Game Tools 12, 2 (2007), 1–12.

2

[Arv95] ARVO J.: Stratiﬁed sampling of spherical triangles. In Proceed-

ings of the 22nd annual conference on Computer graphics and interac-

tive techniques (1995), SIGGRAPH ’95, ACM, pp. 437–438. 2

[AS70] ABRAM OWI TZ M., STEGU N I. A.: Handbook of mathematical

functions: with formulas, graphs, and mathematical tables. Dover Pub-

lications, 1970. 2,3,4,10

[Boo16] Boost - C++ libraries. http://www.boost.org/, 2016.

[Online; accessed 30-March-2016]. 10

[CKN06] COOLS R., KU O F. Y., NUYENS D.: Constructing embed-

ded lattice rules for multivariate integration. SIAM Journal on Scientiﬁc

Computing 28, 6 (2006), 2162–2188. 6

[CW93] COHEN M. F., WALLACE J. R .: Radiosity and realistic image

synthesis. Morgan Kaufmann, 1993. 10

[GSL16] GSL - GNU scientiﬁc library. http://www.gnu.org/

software/gsl/, 2016. [Online; accessed 30-March-2016]. 10

[HJSD16] HEITZ E., JO NATHA N D., STE PHEN H., DAVID N.: Real-

time polygonal-light shading with linearly transformed cosines. In Pro-

ceedings of the 43rd annual conference on Computer graphics and in-

teractive techniques (2016), SIGGRAPH ’16, ACM. to appear. 3

[Kaj86] KAJIYA J. T.: The rendering equation. In Proceedings of the 13th

annual conference on Computer graphics and interactive techniques

(1986), SIGGRAPH ’86, ACM, pp. 143–150. 1

[KF12] KULLA C., FAJA RDO M.: Importance sampling techniques for

path tracing in participating media. Computer Graphics Forum 31, 4

(2012), 1519–1528. 6

[KFC∗10] K ˇ

RIVÁNEK J., FAJARDO M., CHRISTENSEN P. H., TABEL -

LION E., BUN NELL M., LAR SS ON D., KAPLA NYAN A., LE VY B.,

ZHANG R.: Global illumination across industries. SIGGRAPH Courses

(2010). 6

[KHM09] KNIEP S., HÄRING S ., MAGNOR M.: Efﬁcient and accurate

rendering of complex light sources. Computer Graphics Forum 28, 4

(2009), 1073–1081. 3

[NNDJ12] NOVÁK J., NOWROUZEZAHRAI D., DACHS BACHER C.,

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.

M.N. Gamito / Solid Angle Sampling of Disk and Cylinder Lights

JAROSZ W.: Progressive virtual beam lights. Computer Graphics Fo-

rum 31, 4 (2012), 1407–1413. 3

[Pax59] PAXTO N F.: Solid angle calculation for a circular disk. Review

of Scientiﬁc Instruments 30, 4 (1959), 254–258. 3

[PH10] PHARR M., HUMPHREYS G .: Physically Based Rendering:

From Theory to Implementation, 2 ed. Morgan Kaufmann, 2010. 2,

6

[SC97] SHIRL EY P., CHIU K.: A low distortion map between disk and

square. Journal of graphics tools 2, 3 (1997), 45–52. 2

[SWZ96] SHIRLEY P., WANG C., ZIMMERMAN K.: Monte carlo tech-

niques for direct lighting calculations. ACM Transactions on Graphics

(TOG) 15, 1 (1996), 1–36. 2

[TCE05] TALB OT J. F., CLINE D., EGB ERT P. K.: Importance resam-

pling for global illumination. In Proceedings of Eurographics Sympo-

sium on Rendering 2005 (June 2005), Eurographics, pp. 139–146. 9

[Try12] TRYK A S.: Calculation of the solid angle subtended by a cylinder

at a point. Applied Radiation and Isotopes 70, 10 (2012), 2466–2470. 4

[Tur90] TURK G.: Generating random points in triangles. In Graphics

Gems. Academic Press, 1990, pp. 24–28. 2

[TWCC06] TSAI Y.-Y., WANG C.-M., CHANG C.-H., CH ENG Y.-M.:

Tunable bounding volumes for monte carlo applications. In Com-

putational Science and Its Applications-ICCSA 2006. Springer, 2006,

pp. 171–180. 3

[UFK13] UREÑA C., FAJA RDO M., KING A.: An area-preserving

parametrization for spherical rectangles. Computer Graphics Forum 32,

4 (2013), 59–66. 2,3

[VADWG15] VELÁZQUEZ -ARMENDÁRIZ E., DONG Z., WALTE R B.,

GREENB ERG D. P.: Complex luminaires: Illumination and appearance

rendering. ACM Transactions on Graphics (TOG) 34, 3 (2015), 26. 3

[Vea97] VEACH E.: Robust monte carlo methods for light transport sim-

ulation. PhD thesis, Stanford University, 1997. 1

[VG95] VEACH E., GUI BAS L. J.: Optimally combining sampling tech-

niques for monte carlo rendering. In Proceedings of the 22nd annual

conference on Computer graphics and interactive techniques (New York,

NY, USA, 1995), SIGGRAPH ’95, ACM, pp. 419–428. 6,9

[Wan92] WANG C.: Physically correct direct lighting for distribution ray

tracing. In Graphics Gems III. Academic Press, 1992, pp. 307–313. 2

[Wan00] WANG X.: Improving the rejection sampling method in quasi-

monte carlo methods. Journal of computational and applied Mathemat-

ics 114, 2 (2000), 231–246. 6

[Zim95] ZIMMERMAN K.: Direct lighting models for ray tracing with

cylindrical lamps. In Graphics Gems V. Academic Press, 1995, pp. 285–

289. 2,6

c

2016 The Author(s)

Computer Graphics Forum c

2016 The Eurographics Association and John Wiley & Sons Ltd.