Lecture 16 - Bits & Pieces Welcome! , = (, ) - - PowerPoint PPT Presentation

โ–ถ
lecture 16 bits pieces
SMART_READER_LITE
LIVE PREVIEW

Lecture 16 - Bits & Pieces Welcome! , = (, ) - - PowerPoint PPT Presentation

INFOMAGR Advanced Graphics Jacco Bikker - November 2018 - February 2019 Lecture 16 - Bits & Pieces Welcome! , = (, ) , + , , ,


slide-1
SLIDE 1

๐‘ฑ ๐’š, ๐’šโ€ฒ = ๐’‰(๐’š, ๐’šโ€ฒ) ๐‘ ๐’š, ๐’šโ€ฒ + เถฑ

๐‘ป

๐‡ ๐’š, ๐’šโ€ฒ, ๐’šโ€ฒโ€ฒ ๐‘ฑ ๐’šโ€ฒ, ๐’šโ€ฒโ€ฒ ๐’†๐’šโ€ฒโ€ฒ

INFOMAGR โ€“ Advanced Graphics

Jacco Bikker - November 2018 - February 2019

Lecture 16 - โ€œBits & Piecesโ€

Welcome!

slide-2
SLIDE 2

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-3
SLIDE 3

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 ๐œ•๐‘ ๐œ•๐‘— ๐‘‚

slide-4
SLIDE 4

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 ๐œ•๐‘ ๐œ•๐‘— ๐‘‚

slide-5
SLIDE 5

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 ๐œ•๐‘ ๐œ•๐‘— ๐‘‚

slide-6
SLIDE 6

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-7
SLIDE 7

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

slide-8
SLIDE 8

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

slide-9
SLIDE 9

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

slide-10
SLIDE 10

Advanced Graphics โ€“ Bits & Pieces 10

Normals

slide-11
SLIDE 11

Advanced Graphics โ€“ Bits & Pieces 11

Normals

slide-12
SLIDE 12

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

slide-13
SLIDE 13

Advanced Graphics โ€“ Bits & Pieces 13

Normals

slide-14
SLIDE 14

Advanced Graphics โ€“ Bits & Pieces 14

Normals

slide-15
SLIDE 15

Advanced Graphics โ€“ Bits & Pieces 15

Normals

slide-16
SLIDE 16

Advanced Graphics โ€“ Bits & Pieces 16

Normals

slide-17
SLIDE 17

Normal Mapping

A normal map can be used to modify normals. Advanced Graphics โ€“ Bits & Pieces 17

Normals

slide-18
SLIDE 18

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-

  • trivial. For a derivation of the calculation of

T and B, see: learnopengl.com/Advanced-Lighting/Normal-Mapping Advanced Graphics โ€“ Bits & Pieces 18

Normals

slide-19
SLIDE 19

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-20
SLIDE 20

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

slide-21
SLIDE 21

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.

slide-22
SLIDE 22

Paths

Advanced Graphics โ€“ Bits & Pieces 22

Heckbertโ€™s Path Notation*

Vertex types: โ–ช L: light โ–ช E: eye โ–ช S: specular โ–ช D: diffuse (D)+

  • ne 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.

slide-23
SLIDE 23

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-style EDL: Whitted-style, with next event estimation EDSL: Photon mapping, direct visualization of the photon map EDD(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?

slide-24
SLIDE 24

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-style EDL: Whitted-style, with next event estimation EDSL: Photon mapping, direct visualization of the photon map EDD(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

slide-25
SLIDE 25

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).

slide-26
SLIDE 26

Paths

Advanced Graphics โ€“ Bits & Pieces 26

slide-27
SLIDE 27

Paths

Advanced Graphics โ€“ Bits & Pieces 27

slide-28
SLIDE 28

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-29
SLIDE 29

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

slide-30
SLIDE 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: 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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-33
SLIDE 33

MIS

Method 1: direct light sampling

โ–ช Samples only the part of the hemisphere

  • ccupied 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

slide-34
SLIDE 34

MIS

โˆ’๐œŒ ๐œŒ โˆ’๐œŒ ๐œŒ

๐‘ž๐‘’๐‘” = แ‰ 1 ๐‘ก๐‘๐‘š๐‘—๐‘’ ๐‘๐‘œ๐‘•๐‘š๐‘“

angle ๐‘๐‘ ๐‘“๐‘ = เถฑ

โˆ’๐œŒ ๐œŒ

๐‘‘๐‘๐‘ก๐œ„

๐‘ž๐‘’๐‘” = cos ๐œ„ ๐œŒ

Advanced Graphics โ€“ Bits & Pieces 34

slide-35
SLIDE 35

MIS

เถฑ ๐‘” ๐‘ฆ ๐‘’๐‘ฆ = ๐น ๐‘” ๐‘ฆ โ‰ˆ 1 ๐‘‚ เท

๐‘—=1 ๐‘‚

๐‘” ๐‘Œ๐‘— ๐น ๐‘” ๐‘ฆ โ‰ˆ 1 ๐‘‚ เท

๐‘—=1 ๐‘‚ ๐‘” ๐‘Œ๐‘—

๐‘ž ๐‘Œ๐‘—

๐‘š๐‘๐‘ ๐‘•๐‘“ ๐‘ค๐‘๐‘š๐‘ฃ๐‘“ ๐‘ก๐‘›๐‘๐‘š๐‘š ๐‘ค๐‘๐‘š๐‘ฃ๐‘“ = ๐‘ค๐‘“๐‘ ๐‘ง ๐‘š๐‘๐‘ ๐‘•๐‘“ ๐‘š๐‘๐‘ ๐‘•๐‘“ ๐‘ค๐‘๐‘š๐‘ฃ๐‘“ ๐‘š๐‘๐‘ ๐‘•๐‘“ ๐‘ค๐‘๐‘š๐‘ฃ๐‘“ โ‰ˆ 1

Advanced Graphics โ€“ Bits & Pieces 35

Using two pdfs: randomly pick one.

slide-36
SLIDE 36

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 weight to each sample

Advanced Graphics โ€“ Bits & Pieces 36

slide-37
SLIDE 37

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 weight to 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

slide-38
SLIDE 38

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

slide-39
SLIDE 39

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-40
SLIDE 40

Topics

Path tracing BVH GPGPU

  • Filtering

Blue noise Materials

  • Large scenes

Subdivision surfaces, hair, displacement maps Many lights Geometry compression

Future Work

Advanced Graphics โ€“ Bits & Pieces 40

slide-41
SLIDE 41

Todayโ€™s Agenda:

โ–ช On Offsetting Shadows and Reflections โ–ช Consistent Normal Interpolation โ–ช Path Classification โ–ช Packing Normals โ–ช Multiple Importance Sampling, One More Time โ–ช Research Directions

slide-42
SLIDE 42

INFOMAGR โ€“ Advanced Graphics

Jacco Bikker - November 2018 โ€“ February 2019

END of โ€œBits & Piecesโ€

next lecture: โ€œGrand Recapโ€