lecture 15 -bits & pieces - universiteit utrecht
Post on 27-Feb-2022
4 Views
Preview:
TRANSCRIPT
π° π, πβ² = π(π, πβ²) π π, πβ² + ΰΆ±πΊ
π π, πβ², πβ²β² π° πβ², πβ²β² π πβ²β²
INFOMAGR β Advanced GraphicsJacco Bikker - November 2019 - February 2020
Lecture 15 - βBits & Piecesβ
Welcome!
Todayβs Agenda:
βͺ 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?
Offsets
Advanced Graphics β Bits & Pieces 3
p
ππ
πππ
You have been toldβ¦
Geek solution: use fixed point numbers.
This time: epsilon = 1.
Offsets
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 π π
Offsets
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 β π
Offsets
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.
Offsets
Advanced Graphics β Bits & Pieces 7
Todayβs Agenda:
βͺ 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.
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
Normals
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
Normals
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
Normals
Normal Mapping
A normal map can be used to modify normals.
Advanced Graphics β Bits & Pieces 19
Normals
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 theU and V vectors over the surface. This is non-trivial. For a derivation of the calculation ofT and B, see:
learnopengl.com/Advanced-Lighting/Normal-Mapping
Advanced Graphics β Bits & Pieces 20
Normals
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
Normals
Todayβs Agenda:
βͺ 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?
Packing
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);
}
Packing
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 );
}
Packing
Advanced Graphics β Bits & Pieces 27
Todayβs Agenda:
βͺ On Offsetting Shadows and Reflections
βͺ Consistent Normal Interpolation
βͺ Packing Normals
βͺ Spatial Splits in BVHs
βͺ Research Directions
Splitting
Problematic Large Polygons
Large polygons lead to poor BVHs.
(far more common than youβd think)
Advanced Graphics β Bits & Pieces 29
Splitting
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
Splitting
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:
1. A polygon can safely reside in multiple leafs;2. The bounds of a leaf do not have to include the
entire polygon.
*: Early Split Clipping for Bounding Volume Hierarchies, Ernst & Greiner, 2007
Advanced Graphics β Bits & Pieces 31
Splitting
Early Split Clipping
Observations:
1. A polygon can safely reside in multiple leafs;2. The bounds of a leaf do not have to include the
entire polygon.3. BVH construction only uses primitive bounding
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
Splitting
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:
1. Determine cost of optimal object partition;2. Determine cost of optimal spatial split;3. Apply spatial split if cost is lower than object partition*.
*: Spatial Splits in Bounding Volume Hierarchies, Stich et al., 2009
πΆπ ππππ‘ = π΄ππππ‘ β πππππ‘ + π΄πππβπ‘ β ππππβπ‘ < π΄ β π
Advanced Graphics β Bits & Pieces 33
Splitting
State of the Art: SBVH
Summary: high quality bounding volume hierarchies can be obtained by combining the surface area heuristic and spatial splits.
Compared to a regular SAH BVH, spatial splits improve the BVH by ~25% (see paper for scenes and figures).
Advanced Graphics β Bits & Pieces 34
BVH
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
Todayβs Agenda:
βͺ On Offsetting Shadows and Reflections
βͺ Consistent Normal Interpolation
βͺ Packing Normals
βͺ Spatial Splits in BVHs
βͺ Research Directions
Materials
Future Work
Advanced Graphics β Bits & Pieces 40
Other resources:
Implementing the Disney BSDFschuttejoe.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
Future Work
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.
PBRT. Pharr et al., 2004-2018.https://www.pbrt.org
Mitsuba Renderer. W. Jakob, 2014.https://www.mitsuba-renderer.org
Participating Media
Future Work
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
Future Work
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/vertexconnectionandmerging
Primitives
Future Work
Advanced Graphics β Bits & Pieces 44
Other resources:
Direct Ray Tracing of Smoothed andDisplacement 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
Future Work
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
Future Work
Advanced Graphics β Bits & Pieces 46
Other resources:
OptiX: A General Purpose Ray Tracing Engine. Parker et al., 2010.
REAL-TIME RAYTRACINGWITH NVIDIA RTX. Stich, 2018.
(not a lot of research so farβ¦)
Massive Scenes
Future Work
Advanced Graphics β Bits & Pieces 47
Moana Island scene. Heather Pritchett & Rasmus Tamstorf, 2016. ~15 billion primitives.
Todayβs Agenda:
βͺ On Offsetting Shadows and Reflections
βͺ Consistent Normal Interpolation
βͺ Packing Normals
βͺ Spatial Splits in BVHs
βͺ Research Directions
Exam Questions
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
Exam Questions
An exam can be seen as a Monte-Carlo process. Explain why.
Advanced Graphics β Bits & Pieces 50
Exam Questions
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, on averageβ’.
top related