Emerging realtime photorealism: path tracing and friends

Emerging realtime photorealism:
path tracing and friends
COSC342
Lecture 24
21 May 2015
Before we talk about path tracing: point clouds
É
Sampling the real world:
É
É
É
Depth sensing cameras, e.g. Microsoft Kinect (2)
Laser scanners used in geospatial work
Don’t get polygons: get points in space
É
É
É
COSC342
But polygons can be fitted to point clouds . . .
. . . usable in games and real-time graphics?
Perhaps? https://www.youtube.com/watch?v=Irf-HJ4fBls
Emerging realtime photorealism: path tracing and friends
2
Converging ends of a spectrum?
É
We have frequently contrasted:
1. Real-time, scan-line graphics
É
Z-buffers, Gouraud and Phong shading, . . .
2. Raytracing
É
É
“Photorealistic”, refraction, reflection, subsurface scattering, global
illumination, depth of field (DoF) and other lens effects, etc.
Modern hardware challenges this split!
COSC342
Emerging realtime photorealism: path tracing and friends
3
GPGPUs return to graphics
É
We’ve seen GPUs do scan line graphics
É
É
OpenCL/CUDA has GPGPUs do maths
É
É
(General Purpose computing on GPUs)
But raytracing involves lots of maths . . .
É
É
(That’s what they were explicitly built for.)
. . . can GPGPUs can help raytracing?
How long does raytracing take?
COSC342
Emerging realtime photorealism: path tracing and friends
4
Level of Detail (LoD) in scan-line graphics
É
Scene ‘difficulty’ in scan-line graphics with hardware acceleration
depends on:
É
É
É
É
Number of polygons and their size
Textures and fragment processing
Lighting calculation complexity
Frame will be ready after some time
É
COSC342
Determines frame-rate alongside the display’s refresh frequency
Emerging realtime photorealism: path tracing and friends
5
Level of Detail in raytracing?
É
Raytracing difficulty depends on view
É
É
Mirror reflections of mirror reflections . . .
But for a complex scene, we want to be able to ‘bail out’ in an
elegant manner
É
COSC342
But want some idea of scene appearance . . .
Emerging realtime photorealism: path tracing and friends
6
Runtime Path Tracing: Brigade
É
Watch carefully the video at
https://www.youtube.com/watch?v=pXZ33YoKu9w
É
Think about what you see within it:
É
É
COSC342
both in terms of good effects . . .
. . . and also problematic artefacts
Emerging realtime photorealism: path tracing and friends
7
What did you notice?
É
Good:
É
É
É
É
Mirror reflections / glossy surfaces
Indirect illumination
Depth of field
Bad:
É
É
É
COSC342
Speckled noise in the display
Frame rate
Still polygons (. . . is that actually bad?)
Emerging realtime photorealism: path tracing and friends
8
“May I have some path tracing?”
É
The Brigade system is proprietary code
É
É
É
Valuable commercially while new technology
(and that’s for runtime Path Tracing)
Look no further than Blender:
É
É
COSC342
The ‘Cycles’ engine does Path Tracing
. . . planned to replace the internal ray-tracer
Emerging realtime photorealism: path tracing and friends
9
OK, so what is Path Tracing?
É
Simplified: for a ‘sample’ of the scene:
1.
2.
3.
4.
Set up primary ray as usual.
Form new ray from random vector in hemisphere of hit-point normal.
Recurse on that new ray (with depth+1).
Add object emittance to recursion result, scaled by surface BRDF and
reflectance.
É
Repeat the above steps ‘many times’.
É
Take the average colour of all samples.
COSC342
Emerging realtime photorealism: path tracing and friends
10
Bidirectional Reflectance Distribution Function (BRDF)
É
BRDF explains how light behaves at the surface of an opaque object.
É
It is a function of light angle and view angle.
É
Thus a generalisation of both diffuse and specular lighting.
É
It is a four dimensional function (why four?).
COSC342
Emerging realtime photorealism: path tracing and friends
11
BRDF vs. lighting we discussed
É
Lambertian?
É
É
n
just ignore ωr
Phong?
É
É
more than cosn :
get angular effects
ωi
ωr
Figure derived from Wikimedia Commons CC-SA media http://en.wikipedia.org/wiki/File:BRDF_Diagram.svg
COSC342
Emerging realtime photorealism: path tracing and friends
12
Our path tracing was “simplified”
É
Showed algorithm for ‘gathering rays’
É
Can also use ‘shooting rays’ instead
É
É
Go from light source into the scene
Better: ‘bidirectional path tracing’
É
COSC342
Both gathering and shooting; connect paths
Emerging realtime photorealism: path tracing and friends
13
We said “repeat many times”
É
OK, so approximately how many times?
É
For gathering rays we want thousands of samples per surface point.
É
For shooting rays we want orders of magnitude more than that.
COSC342
Emerging realtime photorealism: path tracing and friends
14
Samples: “use average colour”
É
Raytracers average supersampled colours
É
É
É
But scenes look OK without supersampling—
lighting models fairly completely explained (maybe poorly) the
illumination at the hit-point.
Path Tracing process is more of a statistical process.
É
É
COSC342
This is the cause of the speckle noise.
‘Eventually’ the image will converge.
Emerging realtime photorealism: path tracing and friends
15
Beyond BRDF
Specular
Reflection
Diffuse
Reflections
É
Want refraction?
É
Need BTDF: the
Bidirectional
Transmittance
Distribution
Function
Incident
Light Beam
Reflected
Scatter
Distribution
BRDF
Transmitted
Scatter
Distribution
BTDF
Specular
Transmission
Derived from public domain Wikipedia image
COSC342
Emerging realtime photorealism: path tracing and friends
16
Limitations
É
Sub-surface scattering:
É
É
Pathological caustics:
É
É
Need the Bidirectional surface scattering reflectance distribution
function (BSSRDF)
Can use Metropolis Light Transport
Colour effects: basic Path Tracing still won’t simulate a prism
correctly
COSC342
Emerging realtime photorealism: path tracing and friends
17