π± π, πβ² = π(π, πβ²) π π, πβ² + ΰΆ±
π»
π π, πβ², πβ²β² π± πβ², πβ²β² ππβ²β²
INFOMAGR β Advanced Graphics
Jacco Bikker - November 2018 - February 2019
Lecture 15 - Filtering Welcome! , = (, ) , - - PowerPoint PPT Presentation
INFOMAGR Advanced Graphics Jacco Bikker - November 2018 - February 2019 Lecture 15 - Filtering Welcome! , = (, ) , + , , ,
π± π, πβ² = π(π, πβ²) π π, πβ² + ΰΆ±
π»
π π, πβ², πβ²β² π± πβ², πβ²β² ππβ²β²
Jacco Bikker - November 2018 - February 2019
βͺ Noise βͺ Ingredients βͺ State of the Art
Path Tracing
The rendering equation allows us to accurately simulate light transport: βͺ Given a sensible scene description βͺ Given a sensible camera model βͺ Ignoring some complex effects. We evaluate it using Monte Carlo integration:
β The result is always an estimate,
with variance.
Advanced Graphics β Filtering 3
en.wikipedia.org/wiki/Path_tracing
Path Tracing
The rendering equation allows us to accurately simulate light transport: βͺ Given a sensible scene description βͺ Given a sensible camera model βͺ Ignoring some complex effects. We evaluate it using Monte Carlo integration:
β The result is always an estimate,
with variance.
Advanced Graphics β Filtering 4
www.mitsuba-renderer.org
Noise in the Real World
Noise in a digital photo can be the result
Advanced Graphics β Filtering 5
www.photoreview.com.au/tips/shooting/how-to-control-image-noise
Noise in the Real World
Noise in a digital photo can be the result
We solve this by lowering our ISO settings, so we gather more photons per pixel. (that obviously has consequences)
Advanced Graphics β Filtering 6
www.photoreview.com.au/tips/shooting/how-to-control-image-noise
Reducing Noise in Path Tracing
We can increase βexposureβ in a pathtracer by taking more samples.
Advanced Graphics β Filtering 7
aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-1-Initial-C-/
Reducing Noise in Path Tracing
We can increase βexposureβ in a pathtracer by taking more samples. Or we can use Importance Sampling.
Advanced Graphics β Filtering 8
Reducing Noise in Path Tracing
We can increase βexposureβ in a pathtracer by taking more samples. Or we can use Importance Sampling. Or Next Event Estimation. However, at interactive rates it will be quite hard to reach a converged image.
Advanced Graphics β Filtering 9
Advanced Graphics β Filtering 10 well-lit, diffuse: low noise depth of field: moderate noise Indirect light: moderate noise
Not All Noise is Equal
In general, if we can importance sample it, noise will be low: βͺ sample BRDF proportional to cos π; βͺ sample a light proportional to potential contribution. The βfirefliesβ are the result of a random bounce, followed by a specular bounce, which then hit the light: a direction is sampled with a low probability, but yields a high value.
Advanced Graphics β Filtering 11
Not All Noise is Equal
A good RNG is important when producing samples.
Advanced Graphics β Filtering 12
Not All Noise is Equal
A good RNG is important when producing samples. We can do better than a high quality uniform RNG however. Pseudo-random numbers can greatly improve the uniformity, while keeping the relevant properties of random numbers*. Relevant property: avoid correlation.
*: C. Waechter. Quasi-Monte Carlo Light Transport Simulation by Efficient Ray Tracing. PhD thesis, Ulm, 2009.
Advanced Graphics β Filtering 13
Not All Noise is Equal
Our eyes expect noise. βGood noiseβ is uniform, high-frequent, andβ¦ blue*.
*: www.arnoldrenderer.com/arnold/research
Advanced Graphics β Filtering 14
Advanced Graphics β Filtering 15
Advanced Graphics β Filtering 16
Advanced Graphics β Filtering 17
Advanced Graphics β Filtering 18
Suppressing Fireflies
βA firefly is easily recognized in the final image: it is a pixel with a value that differs significantly from its neighbors.β βͺ Is this always true? βͺ How to fix it? βͺ Is that still correct? Firefly suppression introduces bias in our estimator. βͺ Spread out the removed energy over the image / neighborhood βͺ Just wait it out (additional samples will improve the average) βͺ Do some adaptive sampling (detect high variance) βͺ Just Just acc accept it it.
Advanced Graphics β Filtering 19
βͺ Noise βͺ Ingredients βͺ State of the Art
Reducing the Problem - Filtering
Core idea: Exploit the fact that illumination is typically low-frequent: Nearby pixels tend to converge to similar values, so we should be able to use information gathered for one pixel to improve the estimate of the next. Note: Unless neighboring pixels actually converge to the same value, filtering will introduce bias.
Advanced Graphics β Filtering 21
Filter kernels
For the actual filtering, we apply a kernel.
Pixel FilteredValue( ππ¦, ππ§, βπππππππ’β ) π‘π£π = 0 π‘π£ππππππππβπ’ = 0 for ππ¦ = ππ¦ - βπππππππ’β to ππ¦ + βπππππππ’β for ππ§ = ππ§ - βπππππππ’β to ππ§ + βπππππππ’β π‘π£π += ReadPixel( ππ¦, ππ§ ) * weight( ππ¦, ππ§ ) π‘π£ππππππππβπ’ += weight( ππ¦, ππ§ ) return π‘π£π / π‘π£ππππππππβπ’
Here, weight or π₯ is the weight function. We could simply use the Gaussian kernel: π₯ π, π = exp
β ππβππ
2
2ππ
2
,
Advanced Graphics β Filtering 22
ΖΈ ππ = Οπβπͺπ π
ππ₯(π, π)
Οπβπͺπ π₯(π, π)
where ππ and ππ are screen space positions and ππ is the spatial standard deviation of the Gaussian kernel.
Filter kernels
A Gaussian filters (as well as other low-pass filters) blurs out high frequency details. We can improve on this using a non-linear bilateral filter*. π₯ π, π = exp β ππ β ππ
2
2ππ
2
Γ exp β ππ β π
π 2
2ππ
2
*: Tomasi & Manduchi, Bilateral filtering for gray and color images. ICCV β98.
Advanced Graphics β Filtering 23
Filter kernels
The bilateral filter takes the color of nearby pixels into account. We can take this further, by taking an arbitrary set of features into account. The cross bilateral filter*: π₯ π, π = exp β ππ β ππ
2
2ππ
2
Γ ΰ·
π=1 πΏ
exp β π
π,π β π π,π 2
2ππ
2
Here, π
π,π is the πβth feature vector at pixel π and ππ is the bandwidth parameter for feature π.
Note that we can use noise-free features to smooth noisy features. Example of a low-noise feature: normals at the primary intersection point. Example of a noisy feature: indirect illumination at the primary intersection point.
*: Eisemann & Durand. Flash photography enhancement via intrinsic relighting. ACM Trans. Graph. 23, 3 (Aug. 2004).
Advanced Graphics β Filtering 24
Advanced Graphics β Filtering 25 Indirect illumination as a feature: A path tracer allows us to conveniently split direct from indirect, and bounce 1 from bounce 2. Separating illumination into layers allows us to filter each layer separately. This prevents bleeding, and allows for layer-specific kernel sizes. We can also separate albedo from illumination.
Advanced Graphics β Filtering 26
Adding this separation to an existing renderer: βͺ store albedo at the primary intersection (simple material property); βͺ at the end of the pipeline: illumination = sample / max( epsilon, albedo ).
Advanced Graphics β Filtering 27
sinmantyx.wordpress.com/2015/12/02/denoising-cycles-renders-in-blender-theory
Example of denoising using a cross-bilateral filter in Blender.
Advanced Graphics β Filtering 28
Reference 4096 spp Input 4 spp Bilateral 265ms Γ-Trous 64ms Separable 28ms
Not shown here: βͺ Worst-case scenarios βͺ Speculars, glossyβs βͺ Dielectrics βͺ Indirect contact shadows βͺ Temporal stability βͺ 1spp, 2spp, 3spp βͺ Depth of field βͺ β¦
Manifold Filtering*
Core idea: If we split up samples in depth layers, we can filter each layer separately.
*: Sample-based Manifold Filtering for Interactive Global Illumination and Depth of Field. Bauszat et al., 2014.
Advanced Graphics β Filtering 29
Advanced Graphics β Filtering 30
Advanced Graphics β Filtering 31
Reference 4096 spp Input 4 spp Bilateral 265ms Γ-Trous 64ms Separable 28ms
Not shown here: βͺ Worst-case scenarios βͺ Speculars, glossyβs βͺ Dielectrics βͺ Indirect contact shadows βͺ Temporal stability βͺ 1spp, 2spp, 3spp βͺ Depth of field βͺ β¦
Reprojection
Core idea: In an animation, samples taken for the previous frame are meaningful for the current frame. We can supply the filter with more data by looking back in time. Problem: in an animation, the camera moves. We need to find the location of a pixel in the previous frame(s). Solution: use the camera matrices. π4π¦4 π¦π₯ππ ππ π§π₯ππ ππ π¨π₯ππ ππ 1 = π¦π‘ππ πππ π§π‘ππ πππ π¨π‘ππ πππ 1 β π4π¦4
β1
π¦π‘ππ πππ π§π‘ππ πππ π¨π‘ππ πππ 1 = π¦π₯ππ ππ π§π₯ππ ππ π¨π₯ππ ππ 1 (finally, apply the matrix of the previous frame to obtain the screen location in the previous frame.)
Advanced Graphics β Filtering 32
Reprojection
Reprojection using camera matrices: βͺ fails if we have animation βͺ will not work with depth of field βͺ will not work with speculars. For a (partial) solution, we look to the field of video compression: We derive per-pixel motion vectors*.
*: Shan Zhu and Kai-Kuang. A New Diamond Search Algorithm for Fast Block-matching Motion Estimation. Trans. Img. Proc. 9, 2 (Feb. 2000). And: Victor Voorhuis, Beyond Spatiotemporal Variance-Guided Filtering: Temporally Stable Filtering of Path-Traced Reflections in Real-Time. Master thesis, UU, 2018.
Advanced Graphics β Filtering 33
Advanced Graphics β Filtering 34
βͺ Noise βͺ Ingredients βͺ State of the Art
Advanced Graphics β Filtering 36
Advanced Graphics β Filtering 37
βͺ Noise βͺ Ingredients βͺ State of the Art
Jacco Bikker - November 2018 β February 2019
next lecture: βBits and Piecesβ