8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

IMPORTANCE SAMPLING OF
MANY LIGHTS WITH ADAPTIVETREE SPLITTING
Alejandro Conty and Christopher Kulla
Sony Pictures Imageworks

http://aconty.com/slides/hpg2018_many/?print-pdf#/

1/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

WHAT WE ARE TRYING TO ACHIEVE ...

http://aconty.com/slides/hpg2018_many/?print-pdf#/

2/36

8/10/2018

http://aconty.com/slides/hpg2018_many/?print-pdf#/

Importance Sampling of Many Lights with Adaptive Tree Splitting

3/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

For this typical scenario: 363,036 lights
http://aconty.com/slides/hpg2018_many/?print-pdf#/

4/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

OUR METHODA BVH tree over the lights is used for importancesampling
There is no learning: based on heuristics
Accounts for energy, distance and orientation, notvisibility
No grids or caches, low memory overhead

http://aconty.com/slides/hpg2018_many/?print-pdf#/

5/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

MOTIVATIONOriginally designed for mesh lights
They are large collections of small emitters
Avoid choosing the wrong triangle (distant orpointing away)
Usable for collections of arbitrary lights
Avoid grid/learning based methods to:
Optimize time to first pixel
Reduce memory footprint and work on volumes

http://aconty.com/slides/hpg2018_many/?print-pdf#/

6/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

OUR CONTRIBUTIONS
An approach for building the BVH of lights
An importance measure for light clusters
A split sampling method to reduce variancehttp://aconty.com/slides/hpg2018_many/?print-pdf#/

7/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

BUILDING THE TREE
Top-down approach like for raytracing
Bounding boxes are scanned in all axes for ideal
split
A heuristic gives a score for each candidate
Account for the size of the box (Surface Area)
Also for the orientation bounds

http://aconty.com/slides/hpg2018_many/?print-pdf#/

8/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

ORIENTATION BOUNDSAxis
Emission cone spawns from the normals
All emitter normals lie
inside this cone

An axis and two angles. The latter being theemission extent from the normal:
for lambertianemitters, smaller for spot lights.
http://aconty.com/slides/hpg2018_many/?print-pdf#/

9/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

SIZE OF THE 3D BOUNDING BOX
Big boxes with many triangles are bad for raytracing
because the probability of intersection is highFor us they are bad because they poorly represent
their members when computing importance

http://aconty.com/slides/hpg2018_many/?print-pdf#/

10/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

ORIENTATION BOUNDS OF THE CONTAINEDEMITTERS
We measure their solid angle impact
We also try to keep it small because:
They will appear to aﬀect the whole scene
otherwise
They misrepresent their contents for theimportance measure
http://aconty.com/slides/hpg2018_many/?print-pdf#/

11/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

RESULT: SURFACE AREA ORIENTATION HEURISTIC

Proposed cost heuristic for ancluster split whereis the surface area,
our orientation measureandare the energies on each side of the split.
We always split in 3D world axes, but taking into
account orientation measurefor quality.

http://aconty.com/slides/hpg2018_many/?print-pdf#/

12/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

CLUSTER DIVISION AND ORIENTATIONZ

Cut in X

X

Cut in Z

Le split reduces the orientation bounds
http://aconty.com/slides/hpg2018_many/?print-pdf#/

13/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

MORE ON ORIENTATION BOUNDS

Quad Light

Sphere/point Light

Spot LightThe emission part of the bounds will be cosine
weighted. Note our spots are just limited flat emitters
http://aconty.com/slides/hpg2018_many/?print-pdf#/

14/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

BOUNDS OF MULTIPLE EMITTERS
Input A

Input B

Merge Result

Bounds are incrementally expanded to cover multiple
elements in a cluster
http://aconty.com/slides/hpg2018_many/?print-pdf#/

15/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

ORIENTATION MEASURE

Where
http://aconty.com/slides/hpg2018_many/?print-pdf#/16/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

TREE TRAVERSALAn importance function directs the emitterselection
At each branch we pick between le or right
Then stretch the random number and continue
recursively
We choose the emitter with a single random
number (sample warping)
http://aconty.com/slides/hpg2018_many/?print-pdf#/

17/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

Cluster boxes

CLUSTER TREE

TreeShading Point

Importance measure changes with shading point
http://aconty.com/slides/hpg2018_many/?print-pdf#/18/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

IMPORTANCE FUNCTION
A product of three factors: A simple BSDF approximation: The geometric term
: The emitter orientation factor: Total energy inside the cluster

http://aconty.com/slides/hpg2018_many/?print-pdf#/

19/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

Light Cluster

CONSERVATIVE ANGLES

Actual position != center, angles will also change

Shading Point

Varying with the cluster size, the uncertainty angle
has to be subtracted when using the center.
http://aconty.com/slides/hpg2018_many/?print-pdf#/

20/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

BSDF APPROXIMATIONCan be as simple as a diﬀuse term
Include irradiance
But remember to subtract from
Or you can use a BSDF proxyCome to our talk next week!

http://aconty.com/slides/hpg2018_many/?print-pdf#/!

21/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

THE ORIENTATION FACTOR
Compute the angle with the orientation axis

Light Cluster

Subtract
is the resulting angle to the inner orientation conewill be our orientation factor
But rember the uncertainty angle!

Shading Point

http://aconty.com/slides/hpg2018_many/?print-pdf#/

22/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

THE EQUATION
needs to be subtracted from andIfthen is zeroFor participating media:
Geometric decay is linear due to line integral (Angle to bounds comes from a maximization
formula (see paper)

http://aconty.com/slides/hpg2018_many/?print-pdf#/)

23/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

ORIENTATION MATTERS

Shading Point 2KmFaces in the green box are more important
http://aconty.com/slides/hpg2018_many/?print-pdf#/

24/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

IMPORTANCE COMPARISON

http://aconty.com/slides/hpg2018_many/?print-pdf#/

25/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

APPLIED TO VOLUMES

http://aconty.com/slides/hpg2018_many/?print-pdf#/

26/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

ADAPTIVE SAMPLING SPLITTING
Our importance measure is weak when the cluster isnear
will vary too much and diﬀer from the center
The uncertainty angle will be too big
For single sample mesh lights we just clamp to a
fraction of the cluster's bounding sphere radius

http://aconty.com/slides/hpg2018_many/?print-pdf#/

27/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

FOR MANY LIGHTS IT CAN BE IMPROVED
Use more than just 1 random light for a shadingpoint
If a cluster is too big sample both sub-branches
Don't choose one or the otherThe smaller clusters will yield a more reliable
importance
Keep splitting until a heuristic says otherwise
It is better than just increasing SPP
http://aconty.com/slides/hpg2018_many/?print-pdf#/

28/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

SPLIT SAMPLING
Bottom of the tree

Split selection

Shading Point

Nearby clusters are more likely to be split
http://aconty.com/slides/hpg2018_many/?print-pdf#/

29/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

PREDICTED VARIANCE: OUR SPLIT HEURISTICFirst we record energy variancein every cluster
Then variance of the geometric term from theshading pointis the number of emitters in the cluster
are the minimum and maximum distances
given the cluster

http://aconty.com/slides/hpg2018_many/?print-pdf#/

30/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

EFFECT OF SPLITTING

This scene contains 10,000 lights. On the second frame
split sampling is using around 20 lights per shadingpoint
http://aconty.com/slides/hpg2018_many/?print-pdf#/

31/36

8/10/2018

http://aconty.com/slides/hpg2018_many/?print-pdf#/

Importance Sampling of Many Lights with Adaptive Tree Splitting

32/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

A million lights on a Cornell box. Blue areas shade 2-3
lights while the top ones in red shade 28.

http://aconty.com/slides/hpg2018_many/?print-pdf#/

33/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

That's it!

http://aconty.com/slides/hpg2018_many/?print-pdf#/

34/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

36,000 mesh lights 125spp, 27 shadow rays per sample

http://aconty.com/slides/hpg2018_many/?print-pdf#/

35/36

8/10/2018

Importance Sampling of Many Lights with Adaptive Tree Splitting

THANKS FOR LISTENING!
Questions?

http://aconty.com/slides/hpg2018_many/?print-pdf#/

36/36