410

# Real-time Shading with Free-form Planar Area Lights using Linearly Transformed Cosines (JCGT & I3D 2022)

Presentation slides for the research, "Real-time Shading with Free-form Planar Area Lights using Linearly Transformed Cosines" by Kuge et al., which is presented at I3D 2022 (invited from JCGT). May 09, 2022

## Transcript

1. Real-time Shading with Free-form Planar Area Lights using
Linearly Transformed Cosines
Takahiro Kuge1 ○Tatsuya Yatagawa2 Shigeo Morishima1
1Waseda University 2The University of Tokyo

2. Pioneering work by Baum et al. 
l Lambertian surface illuminated by polygonal light
2
Real-time rendering of flat area lights
𝐼 = #
!
𝐿 cos 𝜃 d𝜔
＝ Cosine is integrated over a solid angle
＝ The integral equals to area of projected
figure [Lambert 1760]
Light
source
Solid angle: 𝛀
Projected figure
* A figure is projected to “local” shading plane, and
the shaded object should not be planar.

3. Area of projected figure is analytic when light shape is polygon
3
Baum’s formula
＝ － －
Sum of areas of projected “fans”
𝐼 = +
#
acos 𝐩# ⋅ 𝐩\$
𝐩#×𝐩\$
𝐩#
×𝐩\$
⋅ 𝐞%
𝑗 = 𝑖 + 1 mod 𝑁, 𝐞𝐳
is unit vector along z axis.
Light
source
Solid angle: Ω
Projected figure

4. l Surfaces with Phong BRDF [Arvo 1995]
l Surfaces with Microfacet BRDF (GGX) [Heitz+ 2016]
l Special light shapes, e.g., ellipses and lines [Heitz & Hill 2017]
l Polygon-clipped spherical harmonics [Wang+ 2018; Belcour+ 2018]
4
Extensions of Baum’s approach
[Heitz & Hill 2017] [Wang et al. 2018]
Free-form area lights hasn’t been well investigated!

5. Real-time shading with free-form area lights bounded by 3rd-order Bezier
l Approximate boundary curve with polyline, then apply Baum’s method
→ Adaptive polygonization based on magnitude of light contribution
l Extend [Heitz+ 2016] to handle Microfacet BRDF
→ Efficient clipping operation (shown later) for polynomial curve
Research objectives
5
Real-time shading with free-form area lights bounded by 3rd-order Bezier
l Approximate boundary curve with polyline, then apply Baum’s method
→ Adaptive polygonization based on magnitude of light contribution
l Extend [Heitz+ 2016] to handle Microfacet BRDF
→ Efficient clipping operation (shown later) for polynomial curve

6. Requirement: Area of projected figure is solved analytically
Assume polynomial curve 𝐶 𝑡 = 𝑥 𝑡 , 𝑦 𝑡 , 𝑧 𝑡 is projected to (
𝐶(𝑡)
6
Why difficult to handle polynomial curves?
𝐴 = #
!
"(\$)
\$
𝑦 d\$
𝑥 = # \$
𝑦 𝑡
d\$
𝑥(𝑡)
d𝑡
d𝑡
+
𝐶 𝑡 = \$
𝑥 𝑡 , \$
𝑦 𝑡 , ̃
𝑧 𝑡 =
𝑥 𝑡
𝐶 𝑡
,
𝑦 𝑡
𝐶 𝑡
,
𝑧(𝑡)
𝐶(𝑡)
= #
𝑦 𝑡
𝑥& 𝑡 + 𝑦& 𝑡 + 𝑧&(𝑡)
d
d𝑡
𝑥(𝑡)
𝑥& 𝑡 + 𝑦& 𝑡 + 𝑧&(𝑡)
d𝑡
In general, fractional function does not have analytic infinite integral
Projected figure
Light source
= #
𝑃(3𝐷 − 1)
𝑃(4𝐷)
d𝑡
z
y x
𝐶(𝑡)
%
𝐶(𝑡)
(𝑃 𝐷 : 𝐷th-order polynomial, 𝐷: order of polynomial curve)
projection on
hemisphere

7. Ramer-Douglas-Peucker algorithm
Originally, a method for approximating curve based on “distance” (see figure below)
7
Extension for light contribution:
l Compute increase/decrease of light contribution when new point added
l Subdivide a curve until increase/decrease is sufficiently small

8. For each partial curve, add a midpoint and calculate light contribution from a triangle
8
continue
much
contribution
terminate
little
contribution
terminate
Contribution of each triangle is calculated using Baum’s formula
Partial curve is always
divided by a midpoint
No re-computation
required
little
contribution

9. 9
Threshold for traverse termination
Experiments with constant threshold for different roughness
l Intuition: small threshold slows down shading computation.
Low roughness
Time: not affected
Quality: affected
→ small thres. can be used
High roughness
Time: affected
Quality: not affected
→ large thres. will be fine

10. 10
Threshold for traverse termination
Accordingly, we can use a threshold proportional to roughness
With adaptive thresholding, we obtain both speed and accuracy

11. Real-time shading with free-form area lights bounded by 3rd-order Bezier
l Approximate boundary curve with polyline, then apply Baum’s method
→ Adaptive polygonization based on magnitude of light contribution
l Extend [Heitz+ 2016] to handle Microfacet BRDF
→ Efficient clipping operation (shown later) for polynomial curve
Research objectives
11

12. Microfacet BRDF is approximated by linearly transforming cosine distribution
12
Linearly Transformed Cosines [Heitz et al. 2016]
Linear transformation
Cosine distribution BRDF
By linear transformation, Baum’s formula is available for microfacet BRDF!
Light shape deformation

13. A part can be hidden under the ground after deformed by inverse transformation
l Baum’s formula enforce area light is on upper hemisphere
→ We need to clip (= exclude) the part under the ground
13
Clipping operation
For polygon, each edge is checked intersection with the ground plane
Unfortunately, adaptive polygonization results in considerably many edges
Cosine distribution BRDF
Linear transformation
Light shape deformation
This part must
be clipped!

14. l Points of intersection between boundary curve and shading plane
→ Those with 𝑧 = 0 on the boundary curve
→ Solving cubic equation for z coordinates is sufficient (3rd-order Bezier)
l Owing to affine invariance of Bezier, we can efficiently evaluate transformed
curve by transforming only control points
→ We can instantly obtain the cubic equation
Algebraic clipping
14
𝑎 = −𝑝&,(
+ 3 𝑝),(
− 𝑝*,(
+ 𝑝+,(
𝑏 = 3(𝑝&,(
− 2𝑝),(
+ 𝑝*,(
)
𝑐 = 3(−𝑝&,(
+ 𝑝),(
)
𝑑 = 𝑝&,(
Specifically, we solve the equation below
𝑎𝑡+ + 𝑏𝑡* + 𝑐𝑡 + 𝑑 = 0,
We can algebraically solve polynomial equation whose order is less than five.
𝑡 ∈ 0, 1

15. What we need are only real-number solutions
l [Blinn 2007] shows an efficient solution for cubic equation
15
Algebraic solution for cubic equation
Reference: http://momentsingraphics.de/CubicRoots.html#_Blinn07b

16. Computer:
CPU: Intel Xeon 5119 Gold
GPU: NVIDIA GeForce 1080 (8GB Memory)
RAM: 64GB
Implementation:
l We use the method for both diffuse and specular (shading is computed twice).
l We assume light source itself can intersect with a shading surface (clipping is
performed twice)
Reference pictures:
Rendered by Blender Cycles, Unidirectional Path Tracing (GPU enabled)
16
Experiment

17. Currently, our method spends 1ms for each interval of Bezier curve
17
Rendering result: Concave shape with cavity

18. Currently, our method spends 1ms for each interval of Bezier curve
18
Rendering result: Character

19. Currently, our method spends 1ms for each interval of Bezier curve
19
Rendering result: Textured light

20. Comparison method
l Divide curve domain into a fixed number of intervals
l Then, apply [Heitz+ 2016] with clipping operation to resulting polygon
Comparison with [Heitz+ 2016]
20
For same-quality image,
our method is twice faster!
equal time equal quality

21. Order of computation is a dominant factor.
21
Why ours is faster?
[Heitz et al. 2016]
1. Divide entire boundary curve
into line segments
2. For every line segment,
・Clipping operation
Our method
1. Clip boundary curve
→ Reduce # of curves
2. For only remained curves,
First clipping operation reduce the number of curves processed

Adaptive polygonization concentrates more resource on more important parts

22. Our method shares the same limitations with [Heitz+ 2016]
22
Limitations
Low accuracy for textured lights Highly rough surface illuminated
from small grating angle
Light is entirely hidden
under the ground

23. New real-time shading method for area lights contoured by 3rd-order Bezier.
l Contrib. #1: Adaptive boundary curve polygonization based on light contribution
l Contrib. #2: Efficient clipping operation for polynomial curve (algebraic clipping)
→ More efficient than straightforward application of previous method
Conclusion
23
The same idea will be available for rational Bezier and B-splines!

24. 24
Thank you for listening
GitHub: https://github.com/Paul180297/BezierLightLTC.git