View
3
Download
0
Category
Preview:
Citation preview
๐ฐ ๐, ๐โฒ = ๐(๐, ๐โฒ) ๐ ๐, ๐โฒ + เถฑ๐บ
๐ ๐, ๐โฒ, ๐โฒโฒ ๐ฐ ๐โฒ, ๐โฒโฒ ๐ ๐โฒโฒ
INFOMAGR โ Advanced GraphicsJacco Bikker - November 2018 - February 2019
Lecture 16 - โBits & Piecesโ
Welcome!
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช 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
๐๐
๐๐๐
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 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
๐๐
๐๐
๐
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช 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 7
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 8
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 9
Normals
Advanced Graphics โ Bits & Pieces 10
Normals
Advanced Graphics โ Bits & Pieces 11
Normals
Consistent Normal Interpolation*
Can we come up with an interpolated normal ๐๐ that behaves properly?
โช 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 12
Normals
Advanced Graphics โ Bits & Pieces 13
Normals
Advanced Graphics โ Bits & Pieces 14
Normals
Advanced Graphics โ Bits & Pieces 15
Normals
Advanced Graphics โ Bits & Pieces 16
Normals
Normal Mapping
A normal map can be used to modify normals.
Advanced Graphics โ Bits & Pieces 17
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 18
Normals
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช Research Directions
Paths
Advanced Graphics โ Bits & Pieces 20
Splitting Light Transport
Global illumination consists of:
โช Direct illuminationโช Indirect illumination
Or:
โช Direct illuminationโช Indirect illumination with one diffuse bounceโช Indirect illumination with multiple bounces
Paths
Advanced Graphics โ Bits & Pieces 21
Splitting Light Transport
Light transport consists of:
โช All paths of all lengths between the camera and the light.
Or:
โช All paths with zero or one diffuse vertices, plusโช all paths with at least two diffuse vertices.
Or:
โช All paths that start with ES (e.g. ESDL), plusโช all paths that do not start with ES (e.g. EDDL).
If we can isolate a certain class of paths, we can handle this class with a dedicated rendering algorithm.
Paths
Advanced Graphics โ Bits & Pieces 22
Heckbertโs Path Notation*
Vertex types:
โช L: lightโช E: eyeโช S: specularโช D: diffuse
(D)+ one or more diffuse vertices(D)* zero or more diffuse vertices(D)? zero or one diffuse vertices(DSโ) a diffuse or a specular vertex
*: Heckbert, Adaptive radiosity textures for bidirectional ray tracing. SIGGRAPH 1990.
Paths
Advanced Graphics โ Bits & Pieces 23
Splitting Light Transport
If we can isolate a certain class of paths, we can handle this class with a dedicated rendering algorithm.
ESDL: Whitted-styleEDL: Whitted-style, with next event estimationEDSL: Photon mapping, direct visualization of the photon mapEDD(S*)L: Photon mapping, with final gather
We can also do this to parts of the path:
โช Camera ray: rasterization?โช Path segments that gather direct light: NEEโช Path segments that gather indirect light: baked?
Paths
Advanced Graphics โ Bits & Pieces 24
Splitting Light Transport
If we can isolate a certain class of paths, we can handle this class with a dedicated rendering algorithm.
ESDL: Whitted-styleEDL: Whitted-style, with next event estimationEDSL: Photon mapping, direct visualization of the photon mapEDD(S*)L: Photon mapping, with final gather
We can also do this to parts of the path:
โช Camera ray: rasterization?โช Path segments that gather direct light: NEE + filter, small kernelโช Path segments that gather indirect light: bounce + filter, large kernel
Paths
Advanced Graphics โ Bits & Pieces 25
Splitting Light Transport
If we can evaluate a certain path length using multiple techniques, we can use Multiple Importance Sampling to automatically select the best one.
E.g. Next Event Estimation: EDL via explicit or implicit technique.
Or, BDPT(book, latest edition, 16.3).
Paths
Advanced Graphics โ Bits & Pieces 26
Paths
Advanced Graphics โ Bits & Pieces 27
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช 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 29
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 30
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:
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 31
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช Research Directions
MIS
Method 1: direct light sampling
โช Samples only the part of the hemisphere occupied by unoccluded light sources.
โช Does so by checking the visibility of a random point on a random light.
Method 2: BRDF sampling
โช Samples only the part of the hemisphere not occupied by light sources
โช Does so by rejecting samples that happen to hit a light source.
Method 1 and 2 can (should!) be summed to sample the full hemisphere exactly once.
Advanced Graphics โ Bits & Pieces 33
MIS
โ๐ ๐
โ๐ ๐
๐๐๐ = แ
1
๐ ๐๐๐๐ ๐๐๐๐๐0
angle
๐๐๐๐ = เถฑโ๐
๐
๐๐๐ ๐
๐๐๐ =cos ๐
๐
Advanced Graphics โ Bits & Pieces 34
MIS
เถฑ ๐ ๐ฅ ๐๐ฅ = ๐ธ ๐ ๐ฅ โ1
๐
๐=1
๐
๐ ๐๐
๐ธ ๐ ๐ฅ โ1
๐
๐=1
๐๐ ๐๐
๐ ๐๐
๐๐๐๐๐ ๐ฃ๐๐๐ข๐
๐ ๐๐๐๐ ๐ฃ๐๐๐ข๐= ๐ฃ๐๐๐ฆ ๐๐๐๐๐
๐๐๐๐๐ ๐ฃ๐๐๐ข๐
๐๐๐๐๐ ๐ฃ๐๐๐ข๐โ 1
Advanced Graphics โ Bits & Pieces 35
Using two pdfs:
randomly pick one.
MIS
๐ธ ๐ ๐ โ1
๐
๐=1
๐๐ ๐๐
๐ ๐๐
๐ธ ๐ ๐ โ
๐=1
๐1
๐๐
๐=1
๐๐
๐๐(๐๐,๐)๐ ๐๐,๐
๐๐ ๐๐,๐
This is what we did before.
Now, we combine the sampling techniques.
Weights: ฯ ๐๐ = 1
Most basic weight: 1
๐
(i.e., a weighted average of the techniques).
iterate over the available techniques / pdfs
draw ๐๐ samples using technique ๐
apply a weightto each sample
Advanced Graphics โ Bits & Pieces 36
Weights: ฯ ๐๐ = 1, most basic weight: 1
๐. Can we do better?
Objective: minimize variance in the estimator.
How about this one:
This time, the weight is proportional to the pdf (!).
MIS
๐ธ ๐ าง๐ฅ โ
๐=1
๐1
๐๐
๐=1
๐๐
๐๐(๐๐,๐)๐ ๐๐,๐
๐๐ ๐๐,๐
iterate over the available techniques
draw ๐๐ samples using technique ๐
apply a weightto each sample
๐๐(๐) =๐๐๐๐(๐)
ฯ๐ ๐๐๐๐(๐)
โฆ =
๐=1
๐
๐๐(๐๐)๐ ๐๐
๐๐ ๐๐
๐๐(๐) =๐๐(๐)
ฯ๐ ๐๐(๐)
For two pdfs:
๐๐ด(๐) =๐๐ด(๐)
๐๐ด(๐) +๐๐ต (๐)
๐๐ต(๐) =๐๐ต(๐)
๐๐ด(๐) +๐๐ต (๐)
Letโs set ๐๐ to 1 to simplify things:
We are drawing ๐ from ๐๐ด, and we are looking up the same ๐ in ๐๐ต.
Advanced Graphics โ Bits & Pieces 37
Summarizing:
๐น =
๐=1
๐
๐๐(๐๐)๐ ๐๐
๐๐ ๐๐= ๐๐ด ๐๐ด
๐ ๐๐ด
๐๐ด ๐๐ด+ ๐๐ต ๐๐ต
๐ ๐๐ต
๐๐ต ๐๐ต
where
๐๐ด(๐) =๐๐ด(๐)
๐๐ด ๐ +๐๐ต ๐
and
๐๐ต(๐) =๐๐ต(๐)
๐๐ด(๐) +๐๐ต (๐)
So: for both sampling strategies, we add to the pdf the pdf of the other strategy for the same point on the hemisphere.
MIS
๐๐ด ๐๐ด
๐ ๐๐ด
๐๐ด ๐๐ด
๐๐ต ๐๐ต
๐ ๐๐ต
๐๐ต ๐๐ต=
๐๐ต(๐๐ต)
๐๐ด(๐๐ต) +๐๐ต (๐๐ต)
๐ ๐๐ต
๐๐ต ๐๐ต=
๐ ๐๐ต
๐๐ด ๐๐ต +๐๐ต (๐๐ต)
=๐๐ด(๐๐ด)
๐๐ด(๐๐ด) +๐๐ต (๐๐ด)
๐ ๐๐ด
๐๐ด ๐๐ด=
๐ ๐๐ด
๐๐ด ๐๐ด +๐๐ต (๐๐ด)
=๐ ๐๐ด
๐๐ด ๐๐ด + ๐๐ต(๐๐ด)+
๐ ๐๐ต
๐๐ด(๐๐ต) + ๐๐ต ๐๐ต
Advanced Graphics โ Bits & Pieces 38
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช Research Directions
Topics
Path tracingBVHGPGPU
---------------
FilteringBlue noiseMaterials
---------------
Large scenesSubdivision surfaces, hair, displacement mapsMany lightsGeometry compression
Future Work
Advanced Graphics โ Bits & Pieces 40
Todayโs Agenda:
โช On Offsetting Shadows and Reflections
โช Consistent Normal Interpolation
โช Path Classification
โช Packing Normals
โช Multiple Importance Sampling, One More Time
โช Research Directions
INFOMAGR โ Advanced GraphicsJacco Bikker - November 2018 โ February 2019
END of โBits & Piecesโnext lecture: โGrand Recapโ
Recommended