π± π, πβ² = π(π, πβ²) π π, πβ² + ΰΆ±
π»
π π, πβ², πβ²β² π± πβ², πβ²β² ππβ²β²
INFOMAGR β Advanced Graphics
Jacco Bikker - November 2019 - February 2020
Lecture 15 - Bits & Pieces Welcome! , = (, ) - - PowerPoint PPT Presentation
INFOMAGR Advanced Graphics Jacco Bikker - November 2019 - February 2020 Lecture 15 - Bits & Pieces Welcome! , = (, ) , + , , ,
π± π, πβ² = π(π, πβ²) π π, πβ² + ΰΆ±
π»
π π, πβ², πβ²β² π± πβ², πβ²β² ππβ²β²
Jacco Bikker - November 2019 - February 2020
βͺ On Offsetting Shadows and Reflections βͺ Consistent Normal Interpolation βͺ Packing Normals βͺ Spatial Splits in BVHs βͺ Research Directions
You have been toldβ¦
β¦To offset your shadow rays by βepsilon times R or Lβ. βͺ How should be chose epsilon? βͺ Is epsilon the same everywhere? βͺ Is this always sufficient?
Advanced Graphics β Bits & Pieces 3 p ππ ππ π
You have been toldβ¦
Geek solution: use fixed point numbers. This time: epsilon = 1.
Advanced Graphics β Bits & Pieces 4 p ππ ππ π
SafeOrigin
When R (or L) is almost parallel to the surface, the epsilon offset fails. Alternative: π += cos π3 π π + 1 β cos π3 π π
Advanced Graphics β Bits & Pieces 5 p ππ ππ π
SafeOrigin
When R (or L) is almost parallel to the surface, the epsilon offset fails. Alternative: π += cos π3 β π + 1 β cos π3 β π
Advanced Graphics β Bits & Pieces 6 p ππ ππ π
Second Opinion
Ray Tracing Gems, chapter 6: A Fast and Robust Method for Avoiding Self-Intersection. Carsten WΓ€chter and Nikolaus Binder, 2019.
Advanced Graphics β Bits & Pieces 7
βͺ On Offsetting Shadows and Reflections βͺ Consistent Normal Interpolation βͺ Packing Normals βͺ Spatial Splits in BVHs βͺ Research Directions
The Problem
Vertex normal: the average of the normals of all polygons connected to the vertex. Generating / updating vertex normals in O(N): βͺ set each vertex normal to (0,0,0); βͺ loop over polygons; βͺ add normal of each polygon to each polygon vertex; βͺ normalize all vertex normals.
Advanced Graphics β Bits & Pieces 9
The Problem
Vertex normal: the average of the normals of all polygons connected to the vertex. Using vertex normals: βͺ MΓΆller-Trumbore yields βu,vβ coordinates: these are barycentric coordinates; βͺ calculate π₯ = 1 β (π£ + π€); βͺ now ππ = π₯ β π0 + π£ β π1 + π€ β π2. Mind the side! Advanced Graphics β Bits & Pieces 10
The Problem
Vertex normal: the average of the normals of all polygons connected to the vertex. For grazing directions, the reflection may go into the surface. Now what? βͺ Use geometric normal instead of interpolated normal? βͺ Clamp dot between R and N to 0? βͺ Just return black? Advanced Graphics β Bits & Pieces 11
Advanced Graphics β Bits & Pieces 12
Advanced Graphics β Bits & Pieces 13
Consistent Normal Interpolation*
Can we come up with an interpolated normal ππ that behaves properly? - Requirements: βͺ It is smooth βͺ Reflections in ππ point away from the surface βͺ If all vertex normals are equal to π, ππ = π βͺ If πππ’ π, π = 1, ππ = ππ It turns out that this is indeed possible. The paper outlines how to calculate, for a given π, a vector π that satisfies the constraints. ππ now is simply πππ πππππ¨π π + π .
*: Reshetov et al., Consistent Normal Interpolation. ACM Transactions on Graphics, 2010.
Advanced Graphics β Bits & Pieces 14
Advanced Graphics β Bits & Pieces 15
Advanced Graphics β Bits & Pieces 16
Advanced Graphics β Bits & Pieces 17
Advanced Graphics β Bits & Pieces 18
Normal Mapping
A normal map can be used to modify normals. Advanced Graphics β Bits & Pieces 19
Normal Mapping
A normal map can be used to modify normals. This is typically done in tangent space. Problem: the orientation of tangent space matters. We need to align π and πΆ with the texture, in other words: it needs to be based on the U and V vectors over the surface. This is non-
T and B, see: learnopengl.com/Advanced-Lighting/Normal-Mapping Advanced Graphics β Bits & Pieces 20
What if the normal sends you into the surface
Advanced Graphics β Bits & Pieces 21
What if the normal sends you into the surface
Advanced Graphics β Bits & Pieces 22
What if the normal sends you into the surface
Microfacet-based Normal Mapping for Robust Monte Carlo Path Tracing. SchΓΌssler et al., 2017.
Advanced Graphics β Bits & Pieces 23
βͺ On Offsetting Shadows and Reflections βͺ Consistent Normal Interpolation βͺ Packing Normals βͺ Spatial Splits in BVHs βͺ Research Directions
Efficiently Storing Normals
A float color pixel contains r, g and b. Wouldnβt it be convenient if the fourth component could store the normal? β Can we store a normal accurately in 32 bits? Observation: For a normal, we need two components (plus a sign). β Can we store the two components in 16 bits each?
Advanced Graphics β Bits & Pieces 25
Efficiently Storing Normals
For an extensive study on this topic, see: aras-p.info/texts/CompactNormalStorage.html Bottom line: We can encode a normal in 32-bit, and the precision will be excellent: expect approximately four digits of precision. Pack:
uint PackNormal( float3 N ) { float f = 65535.0f / sqrtf( 8.0f * N.z + 8.0f ); return (uint)(N.x * f + 32767.0f) + ((uint)(N.y * f + 32767.0f) << 16); }
Advanced Graphics β Bits & Pieces 26
Efficiently Storing Normals
For an extensive study on this topic, see: aras-p.info/texts/CompactNormalStorage.html Bottom line: We can encode a normal in 32-bit, and the precision will be excellent: expect approximately four digits of precision. Unpack:
float3 UnpackNormal( uint p ) { float4 nn = make_float4( (float)(p & 65535) * (2.f / 65535.f), (float)(p >> 16) * (2.f / 65535.f), 0, 0 ); nn += make_float4( -1, -1, 1, -1 ); float l = dot( make_float3( nn.x, nn.y, nn.z ), make_float3( -nn.x, -nn.y, -nn.w ) ); nn.z = l, l = sqrtf( l ), nn.x *= l, nn.y *= l; return make_float3( nn ) * 2.0f + make_float3( 0, 0, -1 ); }
Advanced Graphics β Bits & Pieces 27
βͺ On Offsetting Shadows and Reflections βͺ Consistent Normal Interpolation βͺ Packing Normals βͺ Spatial Splits in BVHs βͺ Research Directions
Problematic Large Polygons
Large polygons lead to poor BVHs. (far more common than youβd think) Advanced Graphics β Bits & Pieces 29
Problematic Large Polygons
Large polygons lead to poor BVHs. Using the spatial splits in kD-trees, this is far less of an issue: The triangle will simply be assigned to each subspace. Advanced Graphics β Bits & Pieces 30
Problematic Large Polygons
Large polygons lead to poor BVHs. Using the spatial splits in kD-trees, this is far less of an issue: The triangle will simply be assigned to each subspace. Solution 1: split large polygons*. Observations:
entire polygon.
*: Early Split Clipping for Bounding Volume Hierarchies, Ernst & Greiner, 2007
Advanced Graphics β Bits & Pieces 31
Early Split Clipping
Observations:
entire polygon.
boxes. Algorithm: Prior to BVH construction, we recursively subdivide any polygon with a surface area that exceeds a certain threshold.
Issues:
βͺ Threshold parameter βͺ Individual polygons are split, regardless of surrounding geometry βͺ Primitives may end up multiple times in the same leaf
(some of these issues are resolved in: The Edge Volume Heuristic - Robust Triangle Subdivision for Improved BVH Performance, Dammertz & Keller, 2008)
Advanced Graphics β Bits & Pieces 32
Spatial Splits for BVHs
Observation: spatial splits are not limited to kD-trees. But: spatial splits tend to increase the cost of a split. Idea:
*: Spatial Splits in Bounding Volume Hierarchies, Stich et al., 2009
π·π‘ππππ’ = π΅ππππ’ β πππππ’ + π΅π ππβπ’ β ππ ππβπ’ < π΅ β π Advanced Graphics β Bits & Pieces 33
State of the Art: SBVH
Summary: high quality bounding volume hierarchies can be
Compared to a regular SAH BVH, spatial splits improve the BVH by ~25% (see paper for scenes and figures). Advanced Graphics β Bits & Pieces 34
Advanced Graphics β Bits & Pieces 35
Advanced Graphics β Bits & Pieces 36
Bounding Volume Hierarchies β Final Words
Materials: SAH guided spatial split partitioning for fast BVH construction. Ganestam and Doggett, 2016. Fast Parallel Construction of High-Quality Bounding Volume Hierarchies. Karras and Aila, 2013. Efficient Incoherent Ray Traversal on GPUs Through Compressed Wide BVHs. Ylitie et al., 2017. Tree Rotations for Improving Bounding Volume Hierarchies. Kensler, 2008. Improved Two-Level BVHs using Partial Re-Braiding. Benthin et al., 2017. Advanced Graphics β Bits & Pieces 37
βͺ On Offsetting Shadows and Reflections βͺ Consistent Normal Interpolation βͺ Packing Normals βͺ Spatial Splits in BVHs βͺ Research Directions
Materials
Advanced Graphics β Bits & Pieces 40
Other resources: Implementing the Disney BSDF schuttejoe.github.io/post/disneybsdf Efficient Rendering of Layered Materials using an Atomic Decomposition with Statistical Operators. Belcour, 2018. Eric Heitzβs Research Page: eheitzresearch.wordpress.com/research (all his work is good)
Spectral Rendering
Advanced Graphics β Bits & Pieces 41
Other resources: Hero Wavelength Spectral Sampling. Wilie et al., 2014. Physically Meaningful Rendering using Tristimulus Colours. Meng et al., 2015.
https://www.pbrt.org Mitsuba Renderer. W. Jakob, 2014. https://www.mitsuba-renderer.org
Participating Media
Advanced Graphics β Bits & Pieces 42
Other resources: Importance Sampling Techniques for Path Tracing in Participating Media. Kulla and Fajardo, 2014. Area Light Equi-Angular Sampling on ShaderToy: https://ww.shadertoy.com/view/ldXGzS
Light Transport
Advanced Graphics β Bits & Pieces 43
Other resources: The Rendering Equation. James T. Kajiya, 1986. Bidirectional Path Tracing. Michal Vlnas, 2018 (student paper). Global Illumination using Photon Maps. Jensen, 1996. Progressive Photon Mapping. Hachisuka et al., 2008. (article on) Vertex Connection and Merging, Georgev et al., 2012. https://schuttejoe.github.io/post/vertexcon nectionandmerging
Primitives
Advanced Graphics β Bits & Pieces 44
Other resources: Direct Ray Tracing of Smoothed and Displacement Mapped Triangles. Smits et al., 2000. Direct Ray Tracing of Phong Tessellation. Ogaki and Tokuyoshi, 2011. Two-Level Ray Tracing with Reordering for Highly Complex Scenes. Hanika et al., 2010.
Production
Advanced Graphics β Bits & Pieces 45
Other resources: The Iray Light Transport Simulation and Rendering System. Keller et al., 2017. The Design and Evolution of Disneyβs Hyperion Renderer. Burley et al., 2018. Manuka: A batch-shading architecture for spectral path tracing in movie production. Fascione et al., 2018. Mitsuba 2: A Retargetable Forward and Inverse Renderer. Nimier-David, 2019.
Production
Advanced Graphics β Bits & Pieces 46
Other resources: OptiX: A General Purpose Ray Tracing
REAL-TIME RAYTRACING WITH NVIDIA RTX. Stich, 2018. (not a lot of research so farβ¦)
Massive Scenes
Advanced Graphics β Bits & Pieces 47
Moana Island scene. Heather Pritchett & Rasmus Tamstorf, 2016. ~15 billion primitives.
βͺ On Offsetting Shadows and Reflections βͺ Consistent Normal Interpolation βͺ Packing Normals βͺ Spatial Splits in BVHs βͺ Research Directions
In path tracing, we can reduce variance by using cosine weighted sampling of the hemisphere, rather than uniform sampling, for diffuse surfaces. a) Why does this reduce variance? b) When using cosine weighted sampling, the result remains unbiased. What does unbiased mean? Advanced Graphics β Bits & Pieces 49
An exam can be seen as a Monte-Carlo process. Explain why. Advanced Graphics β Bits & Pieces 50
Advanced Graphics β Bits & Pieces 51 A scene is illuminated by a single double-sided square light souce. Two algorithms are used to sample the light source: the first picks a random point on a random side of the light source, while the second algorithm only picks random points on the side of the light source facing point π. a) Write down the Monte-Carlo integrator that estimates the illumination on point π using the first algorithm. b) Write down the Monte-Carlo integrator that estimates the illumination on point π using the second algorithm. Note: both methods should obviously produce the same answer,
Jacco Bikker - November 2019 β February 2020
next lecture: βBig Pictureβ