lecture 16 bits pieces
play

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

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


  1. INFOMAGR – Advanced Graphics Jacco Bikker - November 2018 - February 2019 Lecture 16 - “Bits & Pieces” Welcome! 𝑱 𝒚, 𝒚 ′ = 𝒉(𝒚, 𝒚 ′ ) 𝝑 𝒚, 𝒚 ′ + න 𝝇 𝒚, 𝒚 ′ , 𝒚 ′′ 𝑱 𝒚 ′ , 𝒚 ′′ 𝒆𝒚′′ 𝑻

  2. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Path Classification ▪ Packing Normals ▪ Multiple Importance Sampling, One More Time ▪ Research Directions

  3. Advanced Graphics – Bits & Pieces 3 Offsets 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? 𝜕 𝑗 𝑂 𝜕 𝑝 p

  4. Advanced Graphics – Bits & Pieces 4 Offsets SafeOrigin When R (or L) is almost parallel to the surface, the epsilon offset fails. Alternative: 𝑃 += cos 𝜄 3 𝜁 𝑆 + 1 − cos 𝜄 3 𝜁 𝑂 𝜕 𝑗 𝑂 𝜕 𝑝 p

  5. Advanced Graphics – Bits & Pieces 5 Offsets SafeOrigin When R (or L) is almost parallel to the surface, the epsilon offset fails. Alternative: 𝑃 += cos 𝜄 3 𝜁 𝑆 + 1 − cos 𝜄 3 𝜁 𝑂 𝑂 𝜕 𝑝 𝜕 𝑗 p

  6. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Path Classification ▪ Packing Normals ▪ Multiple Importance Sampling, One More Time ▪ Research Directions

  7. Advanced Graphics – Bits & Pieces 7 Normals 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.

  8. Advanced Graphics – Bits & Pieces 8 Normals 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!

  9. Advanced Graphics – Bits & Pieces 9 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?

  10. Advanced Graphics – Bits & Pieces 10 Normals

  11. Advanced Graphics – Bits & Pieces 11 Normals

  12. Advanced Graphics – Bits & Pieces 12 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.

  13. Advanced Graphics – Bits & Pieces 13 Normals

  14. Advanced Graphics – Bits & Pieces 14 Normals

  15. Advanced Graphics – Bits & Pieces 15 Normals

  16. Advanced Graphics – Bits & Pieces 16 Normals

  17. Advanced Graphics – Bits & Pieces 17 Normals Normal Mapping A normal map can be used to modify normals.

  18. Advanced Graphics – Bits & Pieces 18 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 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

  19. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Path Classification ▪ Packing Normals ▪ Multiple Importance Sampling, One More Time ▪ Research Directions

  20. Advanced Graphics – Bits & Pieces 20 Paths 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

  21. Advanced Graphics – Bits & Pieces 21 Paths 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.

  22. Advanced Graphics – Bits & Pieces 22 Paths 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.

  23. Advanced Graphics – Bits & Pieces 23 Paths 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?

  24. Advanced Graphics – Bits & Pieces 24 Paths 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

  25. Advanced Graphics – Bits & Pieces 25 Paths 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).

  26. Advanced Graphics – Bits & Pieces 26 Paths

  27. Advanced Graphics – Bits & Pieces 27 Paths

  28. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Path Classification ▪ Packing Normals ▪ Multiple Importance Sampling, One More Time ▪ Research Directions

  29. Advanced Graphics – Bits & Pieces 29 Packing 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?

  30. Advanced Graphics – Bits & Pieces 30 Packing 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); }

  31. Advanced Graphics – Bits & Pieces 31 Packing 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 ); }

  32. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Path Classification ▪ Packing Normals ▪ Multiple Importance Sampling, One More Time ▪ Research Directions

  33. Advanced Graphics – Bits & Pieces 33 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.

Recommend


More recommend