程序代写代做代考 PowerPoint Presentation

PowerPoint Presentation

14. Light Transport
Dr. Hamish Carr

COMP 5812M: Foundations of Modelling & Rendering
Rendering Equation
The answer according to physics
A single equation that captures all light
We will then have to convert it to code
But the idea is pretty simple
We will, however, need some assumptions

COMP 5812M: Foundations of Modelling & Rendering
Assumptions
Initially, assume reflection only
i.e. scattering is defined by a BRDF
broken in two parts
impulse (mirror) reflection/transmission
scattering via integration
Point (impulse) and area (integral) luminaires
Scene is finite and constructed of manifolds

COMP 5812M: Foundations of Modelling & Rendering
More Assumptions
Escaping light disappears (black sphere)
Ray-casting function
finds first intersection Q along ray (P, d)
Steady-state (no time dependence)
Radiance only (no wavelength dependence)
Emitted radiance at all points:

COMP 5812M: Foundations of Modelling & Rendering
Rendering Equation

: Light reflected at P in direction
Integral over all incoming directions
Light flow coming in from
: BRDF: reflectance from to
: Dot product for angled patch

COMP 5812M: Foundations of Modelling & Rendering
Adding Emission
+
+
is the surface radiance
is the field radiance
Originally described by Kajiya and by Immel in 1986
This is an integral equation
Effectively impossible to solve analytically

COMP 5812M: Foundations of Modelling & Rendering
Transport Equation
Field radiance has to come from somewhere
So trace back along each direction
It must be the outgoing light from somewhere

Results in:
+

COMP 5812M: Foundations of Modelling & Rendering
Solving Computationally
For each ray (pixel)
Find first intersection along ray
On the first bounce, add emission
Add direct light from point (impulse) lights
Add direct light from area lights
Add indirect light from reflections

COMP 5812M: Foundations of Modelling & Rendering
Path Tracer Code

COMP 5812M: Foundations of Modelling & Rendering
Direct Point Lights
Test shadow ray from P to light source
If it intersects an object, no direct light
Else apply scattering model / BRDF
E.g. simple Lambertian reflection
Weighted for angle as usual
Sum over all point lights
Direct area lights are similar (later)

COMP 5812M: Foundations of Modelling & Rendering
Direct Point Light Code

COMP 5812M: Foundations of Modelling & Rendering
Indirect Lighting
Assume all remaining light is indirect
Integrate over all incoming directions
Practical solution:
Average over many incoming directions
Chosen randomly (whatever that means)
Find outgoing light from previous bounce

COMP 5812M: Foundations of Modelling & Rendering
Indirect Lighting Code
“All” we have to do is write surfel.scatter()
And justify the use of coeff

COMP 5812M: Foundations of Modelling & Rendering
Scatter()
The scatter procedure must randomise rays
And scale to the hemispherical reflectance
total reflectance for all incoming rays
if it’s 70%, we terminate early 30% of the time
this is an extinction coefficient
easier than trying to integrate
proportion of photons that were absorbed

COMP 5812M: Foundations of Modelling & Rendering
Recursion
We invoke pathTrace recursively
Each bounce generates more rays
But eventually all rays terminate
Due to extinction coefficient (the base case)
However, this is why the large run times
Real-time rendering is about optimising this

COMP 5812M: Foundations of Modelling & Rendering
Adding Transmission
Substitute a scattering equation

Integrates over all incoming directions
BRDF becomes BSDF
dot product now has absolute value
and we add in, out annotations

COMP 5812M: Foundations of Modelling & Rendering
Practical Effects
Transmission can be treated as an impulse
So this doesn’t change the code much
Unless we want really fancy effects
Then integrate over input directions anyway

COMP 5812M: Foundations of Modelling & Rendering
Sensor Modelling
Measuring the light is also an integral

describes the pixel & it’s cone of rays
Typically the same form for all pixels
Also known as the importance function
Can be used to optimise the path tracer

COMP 5812M: Foundations of Modelling & Rendering