Rendering: Path Tracing II
Adam Celarek
Research Unit of Computer Graphics Instjtute of Visual Computjng & Human-Centered Technology TU Wien, Austria
Rendering: Path Tracing II Adam Celarek Research Unit of Computer - - PDF document
Rendering: Path Tracing II Adam Celarek Research Unit of Computer Graphics Instjtute of Visual Computjng & Human-Centered Technology TU Wien, Austria Path Tracing Basics (Last tjme) Materials / BSDF Path Tracing Algorithm
Research Unit of Computer Graphics Instjtute of Visual Computjng & Human-Centered Technology TU Wien, Austria
Path Tracing II (Adam Celarek) 2
Basics (Last tjme)
Materials / BSDF Path Tracing Algorithm Next Event Estjmatjon (NEE) Russian Rouletue
Details & Advanced (Now)
Filtering Parallelisatjon Measuring Error Post-processing
Path Tracing II (Adam Celarek) 3
source: own work
Mission: Prevent sampling artefacts (aliasing)
Path Tracing II (Adam Celarek) 4
With fjltering Without fjltering
source: Table scene designed by Olesya Jakob rendered with Nori
Path Tracing II (Adam Celarek) 5
With fjltering Without fjltering
source: Table scene designed by Olesya Jakob rendered with Nori
Path Tracing II (Adam Celarek) 6
We are in the main rendering loop, where we loop over pixels and
Path Tracing II (Adam Celarek) 7
We are in the main rendering loop, where we loop over pixels and
Currently, you are using the box fjlter But let‘s go a step back for now and
Current pixel N samples Current pixel All N samples go through the centre
Path Tracing II (Adam Celarek) 8
Forget one screen dimension (works the same for higher
Next, we’ll forget about one of the screen dimensions and start to think about a 1d function f(x). This is to make the explanation easier. All of the results also apply to the 2d screen we have in rendering.
sample and reconstruct as pixels on the screen.
it’s shorter.
result using Monte Carlo. It’s the same process no matter the notation.
we have a function f that eats screen coordinates. The definition of the function tells to shoot a ray through that position, and compute the light
position of the screen.
stochastic variable like in Monte Carlo Integration. That means that it always returns the same value for a given position, and positions are not discrete like monitor pixels.
Path Tracing II (Adam Celarek) 9
Forget one screen dimension (works the same for higher
This is a sampling problem,
We want to reconstruct the
Sample positjons
Path Tracing II (Adam Celarek) 10
Sample positjons This is OK. The reconstructjon is faithful! Here not so much!
Path Tracing II (Adam Celarek) 11
Sample positjons
Path Tracing II (Adam Celarek) 12
It should integrate to 1,
Well, actually, that is only needed theoretjcally, because our implementatjon will use normalisatjon anyways.
The smoothing should be the right size Too small and too many of the large frequencies are retained Too large and we get visible blurring A shape that reduces artefacts (will not go into detail, see reading material).
Path Tracing II (Adam Celarek) 13
Path Tracing II (Adam Celarek) 14
source: Vierge Marie, Wikipedia (public domain)
Mitchell-Netravali-Filter with parameters (⅓, ⅓)
Path Tracing II (Adam Celarek) 15
Pixel Filter h(x) Signal f(x) Samples X
Path Tracing II (Adam Celarek) 16
Pixel Filter h(x) Signal f(x) Samples X h*f Normalisatjon (box: divide by N)
Path Tracing II (Adam Celarek) 17
In 1d: In 2d:
Path Tracing II (Adam Celarek) 18
Path Tracing II (Adam Celarek) 19
Path Tracing II (Adam Celarek) 20
Path Tracing II (Adam Celarek) 21
Why → Antj-aliasing Which fjlters → low-pass, box, tent, Gaussian, others How → Convolutjon + normalisatjon That a sample can also afgect neighbouring
Path Tracing II (Adam Celarek) 22
Pharr, et al., Physically Based Rendering (Chapter 7) Smith (1995), A Pixel Is Not A Litule Square! Mitchell & Netravali (1988),
Search for sampling theory
Path Tracing II (Adam Celarek) 23
Low-pass fjlter for image signal Sample in pixel centre
source: own work
Mission: Prevent sampling artefacts (aliasing)
Path Tracing II (Adam Celarek) 24
source: own work
Mission: Performance
Path Tracing II (Adam Celarek) 25
Each sample Xj,i is independent
Could start a new thread for each sample
Synchronisatjon at the sum expensive Overhead
A new thread per pixel
Stjll some overhead Synchronisatjon between pixels because of overlapping fjlters
→ Render blocks
Path Tracing II (Adam Celarek) 26
Path Tracing II (Adam Celarek) 27
Path Tracing II (Adam Celarek) 28
Use a separate sum for the
Per render block, store these
When a block is fjnished, add to a
Path Tracing II (Adam Celarek) 29
Use a separate sum for the
Per render block, store these
When a block is fjnished, add to a
Path Tracing II (Adam Celarek) 30
Divide the image in small blocks, and let 1 thread work on one block Some other rendering algorithms might require to hold the whole
Rendering very easy to parallelise, even to multjple machines When using 32bit fmoat format, we can even compute the mean of
Some years ago I rendered stufg on a super computer in Finland and
Path Tracing II (Adam Celarek) 31
Render in blocks Blocks include a small border to account
Can easily parallelise to multjple
source: own work
Mission: Performance
Path Tracing II (Adam Celarek) 32
source: own work
Mission: Know how good or bad we are
Path Tracing II (Adam Celarek) 33
Estjmators estjmate values – for instance the colour of a pixel Ofuen denoted with a hat: Error of an estjmator:
Alternatjvely, amplitude of the error, relatjve error, or (mean) squared error for arrays of estjmators.
Real I not available, so use a high quality reference estjmate
Path Tracing II (Adam Celarek) 34
Reference Absolute Error
Path Tracing II (Adam Celarek) 35
References Standard deviatjon
Path Tracing II (Adam Celarek) 36
Unbiased Biased but consistent Biased
… classes of estimators.
samples on the x-axis. You won’t see such plots in papers or websites, as
visualising the concept here.
the expectation of the estimator equal to to true value **point**. The error plot of a single estimate oscillates around zero and the amplitudes become smaller as N increases **point**.
converges to the ground truth. The error can be negative as well, this here **point** is just an example.
nicer picture with less noise, that doesn’t match the physics of light for
fireflies as you saw them in the first part of the path tracing), limiting the recursion depth, or just not render certain effects, like for instance caustics.
Path Tracing II (Adam Celarek) 37
Path Tracing II (Adam Celarek) 38
Variance (variability) Variance of the following expression of uncorrelated X Central limit theorem (CLT)
Path Tracing II (Adam Celarek) 39
Path Tracing II (Adam Celarek) 40
Path Tracing II (Adam Celarek) 41
Variance of the estjmator becomes smaller with a larger N
Path Tracing II (Adam Celarek) 42
The distributjon of error of a Monte Carlo estjmator tends towards
Its expectatjon is 0 (yes, because it‘s unbiased). The variance of the estjmator is also the variance of the error. The variance is in strict relatjon with the number of samples:
Path Tracing II (Adam Celarek) 43
Path Tracing II (Adam Celarek) 44
Path Tracing II (Adam Celarek) 45
Standard deviatjon per pixel Bathroom scene
source: own work
Path Tracing II (Adam Celarek) 46
Standard deviatjon per pixel Botule scene
source: own work
Path Tracing II (Adam Celarek) 47
Standard deviatjon per pixel Botule scene
More samples here
source: own work
Path Tracing II (Adam Celarek) 48
Standard deviatjon per pixel Botule scene
More smoothing here
source: own work
Path Tracing II (Adam Celarek) 49
source: own work
Path Tracing II (Adam Celarek) 50
Mean square error (MSE), per pixel mean of (rendering - reference)2
Very popular in literature many variatjon (relatjve to brightness, mean absolute error, root of MSE to
be linear..)
However, sensitjve to outliers
I‘m advocatjng to use root mean variance
Path Tracing II (Adam Celarek) 51
Celarek (2017),
Celarek (2019), Quantjfying the Error of Light Transport Algorithms
Path Tracing II (Adam Celarek) 52
Simply variance or standard deviatjon
Adaptjve sampling Filtering / smoothing noise Comparisons
source: own work
Mission: Know how good or bad we are
Path Tracing II (Adam Celarek) 53
source: own work
Mission: Store or display renderings
Path Tracing II (Adam Celarek) 54
Dynamic Range Examples Device / Setting Real world 800 000 : 1 Surface illuminated by sun : moon 100 : 1 Diffuse white : black surface 80 000 000 : 1 Expected real world dynamic range Human vision 100 : 1 Photoreceptors 10 : 1 Pupil size 100 000 : 1 Neural adaptation 100 000 000 : 1 Dynamic range of human vision Technology 1 000 : 1 Displays 256 : 1 8 bit image files 1076 : 1 32 bit float
source: Thomas Auzinger, Rendering lecture 2019
Path Tracing II (Adam Celarek) 55
We compute radiance in 32 bit fmoatjng point precision However, most displays and image formats use an 8 bit unsigned
Map high dynamic range (HDR) image data to 0 – 1 (8 bit) for
We need to apply range compression Nowadays there are also 10 or even 12bit displays, which would
source: Thomas Auzinger, Rendering lecture 2019
Path Tracing II (Adam Celarek) 56
source: Thomas Auzinger, Rendering lecture 2019 (from htup://dcgi.felk.cvut.cz/home/cadikm/tmo/)
Path Tracing II (Adam Celarek) 57
source: Thomas Auzinger, Rendering lecture 2019 (from htup://dcgi.felk.cvut.cz/home/cadikm/tmo/)
Path Tracing II (Adam Celarek) 58
source: Thomas Auzinger, Rendering lecture 2019 (from htup://dcgi.felk.cvut.cz/home/cadikm/tmo/)
Path Tracing II (Adam Celarek) 59
source: Thomas Auzinger, Rendering lecture 2019 (from htup://dcgi.felk.cvut.cz/home/cadikm/tmo/)
Path Tracing II (Adam Celarek) 60
source: Thomas Auzinger, Rendering lecture 2019 (from htup://dcgi.felk.cvut.cz/home/cadikm/tmo/)
Path Tracing II (Adam Celarek) 61
Global:
+ Fast - But loss of detail
Local:
- Slow + Local contrast enhancement
source: Thomas Auzinger, Rendering lecture 2019
Path Tracing II (Adam Celarek) 62
Reinhard et al., Photographic tone reproductjon for digital images,
Widely used Global and local variant Listjng processing steps would
source: Thomas Auzinger, Rendering lecture 2019
Path Tracing II (Adam Celarek) 63
source: Thomas Auzinger, Rendering lecture 2019
Global Local
(from http://cybertron.cg.tu-berlin.de/pdci08/tonemapping/tone_mapping.html)
Path Tracing II (Adam Celarek) 64
source: Thomas Auzinger, Rendering lecture 2019
Global Local
(from http://cybertron.cg.tu-berlin.de/pdci08/tonemapping/tone_mapping.html)
Path Tracing II (Adam Celarek) 65
Bilateral fjlters
Gradient processing
Fatual et al., Gradient domain HDR compression, Siggraph 2002
Etc..
source: Thomas Auzinger, Rendering lecture 2019
Path Tracing II (Adam Celarek) 66
Gamma Encoding
Human perceptjon of brightness follows an approximate power functjon. Greater sensitjvity to relatjve difgerences between darker tones. Therefore, gamma encoding is used to optjmise the usage of bits when
storing or transmittjng an image.
It’s applied afuer tone mapping, , check online sources for more
info.
You might need to decode gamma when reading textures (most image
formats store gamma encoded, but light simulatjon needs linear intensitjes)
source: Wikipedia
Path Tracing II (Adam Celarek) 67
Tone-mapping to map from HDR to
Gamma encoding for storage Not needed when using HDR formats
source: own work
Mission: Store or display renderings
Path Tracing II (Adam Celarek) 68
Filtering Parallelisatjon Measuring Error Post-processing
source: own work