lecture 15 bits pieces
play

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

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


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

  2. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Packing Normals ▪ Spatial Splits in BVHs ▪ 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 You have been told… Geek solution: use fixed point numbers. This time: epsilon = 1 . 𝜕 𝑗 𝑂 𝜕 𝑝 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. Advanced Graphics – Bits & Pieces 6 Offsets SafeOrigin When R (or L) is almost parallel to the surface, the epsilon offset fails. Alternative: 𝑃 += cos 𝜄 3 ∙ 𝑆 + 1 − cos 𝜄 3 ∙ 𝑂 𝑂 𝜕 𝑝 𝜕 𝑗 p

  7. Advanced Graphics – Bits & Pieces 7 Offsets Second Opinion Ray Tracing Gems, chapter 6: A Fast and Robust Method for Avoiding Self-Intersection. Carsten Wächter and Nikolaus Binder, 2019.

  8. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Packing Normals ▪ Spatial Splits in BVHs ▪ Research Directions

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

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

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

  12. Advanced Graphics – Bits & Pieces 12 Normals

  13. Advanced Graphics – Bits & Pieces 13 Normals

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

  15. Advanced Graphics – Bits & Pieces 15 Normals

  16. Advanced Graphics – Bits & Pieces 16 Normals

  17. Advanced Graphics – Bits & Pieces 17 Normals

  18. Advanced Graphics – Bits & Pieces 18 Normals

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

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

  21. Advanced Graphics – Bits & Pieces 21 Normals What if the normal sends you into the surface

  22. Advanced Graphics – Bits & Pieces 22 Normals What if the normal sends you into the surface

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

  24. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Packing Normals ▪ Spatial Splits in BVHs ▪ Research Directions

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

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

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

  28. Today’s Agenda: ▪ On Offsetting Shadows and Reflections ▪ Consistent Normal Interpolation ▪ Packing Normals ▪ Spatial Splits in BVHs ▪ Research Directions

  29. Advanced Graphics – Bits & Pieces 29 Splitting Problematic Large Polygons Large polygons lead to poor BVHs. (far more common than you’d think)

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

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

  32. Advanced Graphics – Bits & Pieces 32 Splitting Early Split Clipping Issues: ▪ Observations: Threshold parameter ▪ Individual polygons are split, 1. A polygon can safely reside in multiple leafs; regardless of surrounding geometry 2. The bounds of a leaf do not have to include the ▪ Primitives may end up multiple times entire polygon. in the same leaf 3. BVH construction only uses primitive bounding boxes. Algorithm: (some of these issues are resolved in: The Edge Prior to BVH construction, we recursively subdivide Volume Heuristic - Robust Triangle Subdivision for any polygon with a surface area that exceeds a Improved BVH Performance, Dammertz & Keller, certain threshold. 2008)

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

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

  35. Advanced Graphics – Bits & Pieces 35 Better BVHs

  36. Advanced Graphics – Bits & Pieces 36 Better BVHs

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend