lecture 1 introduction
play

Lecture 1 - Introduction Welcome! , = (, ) , - PowerPoint PPT Presentation

INFOMAGR Advanced Graphics Jacco Bikker - November 2016 - February 2017 Lecture 1 - Introduction Welcome! , = (, ) , + , , ,


  1. INFOMAGR – Advanced Graphics Jacco Bikker - November 2016 - February 2017 Lecture 1 - “Introduction” Welcome! 𝑱 𝒚, 𝒚 ′ = 𝒉(𝒚, 𝒚 ′ ) 𝝑 𝒚, 𝒚 ′ + 𝝇 𝒚, 𝒚 ′ , 𝒚 ′′ 𝑱 𝒚 ′ , 𝒚 ′′ 𝒆𝒚′′ 𝑻

  2. Today’s Agenda:  Advanced Graphics  Recap: Ray Tracing  Whitted-style  Assignment 1

  3. Advanced Graphics – Introduction 3 INFOMAGR Website http://www.cs.uu.nl/docs/vakken/magr  Site information overrules official schedule  Downloads, news, slides, deadlines, links Please check regularly.

  4. Advanced Graphics – Introduction 4 INFOMAGR Abstract Concrete / informal: In this course, we explore physically based rendering, with 1. You’ll know how a photo - a focus on interactivity. realistic image is produced 2. You know how to do this At the end of this course, you will have a solid theoretical quickly / efficient understanding of efficient physically based light transport. 3. You have built such a renderer You will also have a good understanding of acceleration 4. You have built an interactive structures for fast ray/scene intersection for static and ray tracer dynamic scenes. 5. You know how to do this on the GPU You will have hands-on experience with algorithms for efficient realistic rendering of static and dynamic scenes 6. You got a great score using ray tracing on CPU and GPU. 7. You had fun

  5. Advanced Graphics – Introduction 5 INFOMAGR Topics We will cover the following topics:  Ray tracing fundamentals;  Whitted-style ray tracing;  Acceleration structure construction;  Acceleration structure traversal;  Data structures and algorithms for animation;  Stochastic approaches to AA, DOF, soft shadows, … ;  Path tracing;  Variance reduction in path tracing algorithms;  Various forms of parallelism in ray tracing.

  6. Advanced Graphics – Introduction 6 INFOMAGR Lectures ~13 lectures: Tuesday 11:00 – 12:45, Thursday 13:15 – 15:00 ~7 working colleges: Thursday 15:15 – 17:00 (starting week 2) Attendance is not mandatory, but of course highly recommended. We move fast; missing a key lecture may be a serious problem.

  7. Advanced Graphics – Introduction 7 INFOMAGR Literature Papers and online resources will be supplied during the course. Slides will be made available after each lecture. Recommended literature: Physically Based Rendering, Second Edition – From Theory to Implementation, Pharr & Humphreys. Morgan Kaufmann, 2010. ISBN-10: 0123750792. Recently, the Third Edition was released.

  8. Advanced Graphics – Introduction 8 INFOMAGR Dependencies It is assumed that you have basic knowledge of rendering (INFOGR) and associated mathematics. You also should be a decent programmer; this is explicitly not a purely theoretical course. You are expected to verify the theory and experience the good and the bad. A brief introduction to GPGPU and SIMD will be provided for those that did not take INFOMOV.

  9. Advanced Graphics – Introduction 9 INFOMAGR Resources You will develop a ray tracing testbed for assignment 1. As a starting point, several ‘templates’ are available: Tmpl85.00a A basic C++ framework for graphics programming, which opens a window, provides a 32-bit RGB framebuffer, and some basic helper classes. gpu_lab (available halfway the course) A basic C++ framework for GPGPU via CUDA and OpenCL. Template_C# A basic C# template which uses OpenTK to provide a 32-bit RGB framebuffer as well as OpenGL functionality, and Cloo for using OpenCL.

  10. Advanced Graphics – Introduction 10 INFOMAGR Assignments 1. (weight: 1): Ray tracing framework For this assignment, you prepare a testbed for subsequent assignments. 2. (weight: 1): Acceleration structures In this assignment, you expand your testbed with efficient acceleration structure construction and traversal. This enables you to run Whitted-style ray tracing in real-time. 3. (weight: 2): Final assignment In this assignment, you either implement an interactive path tracer, or a rendering algorithm you chose, using CPU and/or GPU rendering.

  11. Advanced Graphics – Introduction 11 INFOMAGR Exam One final exam at the end of the block. Materials to study:  Slides  Notes taken during the lectures  Provided literature  Assignments

  12. Advanced Graphics – Introduction 12 INFOMAGR Grading & Retake Final grade for assignments 𝑄 = (𝑄1 + 𝑄2 + 2 ∗ 𝑄3) / 4 Final grade for INFOMAGR 𝐻 = (2𝑄 + 𝐹) / 3 Passing criteria:  𝑄 ≥ 5.00 (before rounding)  𝐹 ≥ 5.00 (before rounding)  𝐻 ≥ 6 (after rounding) Repairing your grade using the retake exam or retake assignment:  only if 𝑄 ≥ 4.00 and 𝐹 ≥ 4.00 and 𝐻 < 5.50  you redo P1 or P2 or P3 or E  this replaces the original P1, P2, P3 or E grade.

  13. Today’s Agenda:  Advanced Graphics  Recap: Ray Tracing  Whitted-style  Assignment 1

  14. Advanced Graphics – Introduction 14 Recap Ray A ray is an infinite line with a start point: 𝑞(𝑢) = 𝑃 + 𝑢𝐸 , where 𝑢 > 0 . The ray direction 𝐸 is usually normalized.

  15. Advanced Graphics – Introduction 15 Recap Scene The scene consists of a number of primitives:  Spheres  Planes  Triangles ..or anything for which we can calculate the intersection with a ray. We also need:  A camera (position, direction, FOV, focal distance, aperture size)  Light sources

  16. Advanced Graphics – Introduction 16 Recap Ray Tracing World space  Geometry  Eye  Screen plane  Screen pixels  Primary rays  Intersections  Point light  Shadow rays Light transport  Extension rays Light transport

  17. Advanced Graphics – Introduction 17 Recap Ray setup A ray is initially shot through a pixel on the screen plane. The screen plane is defined in world space: Camera position: E = (0,0,0) View direction: 𝑊 Screen center: C = 𝐹 + 𝑒𝑊 Screen corners: p 0 = 𝐷 + −1, −1,0 , 𝑞 1 = 𝐷 + 1, −1,0 , 𝑞 2 = 𝐷 + (−1,1,0) From here:  Change FOV by altering 𝑒 ;  Transform camera by multiplying E, 𝑞 0 , 𝑞 1 , 𝑞 2 with the camera matrix.

  18. Advanced Graphics – Introduction 18 Recap Ray setup 𝑞 1 Point on the screen: u 𝑞 0 𝑞 𝑣, 𝑤 = 𝑞 0 + 𝑣 𝑞 1 − 𝑞 0 + 𝑤(𝑞 2 − 𝑞 0 ) 𝑣, 𝑤 ∈ [0,1] v Ray direction (normalized): 𝐹 𝑞 𝑣, 𝑤 − 𝐹 𝐸 = ∥ 𝑞 𝑣, 𝑤 − 𝐹 ∥ Ray origin: 𝑃 = 𝐹 𝑞 2

  19. Advanced Graphics – Introduction 19 Recap Ray Intersection 𝑞 1 Given a ray 𝑞(𝑢) = 𝑃 + 𝑢𝐸 , we determine the closest intersection distance 𝑢 by intersecting the ray with 𝑞 0 each of the primitives in the scene. Ray / plane intersection: 𝐹 Plane: 𝑞 ∙ 𝑂 + 𝑒 = 0 Ray: 𝑞(𝑢) = 𝑃 + 𝑢𝐸 Substituting for 𝑞(𝑢) , we get 𝑃 + 𝑢𝐸 ∙ 𝑂 + 𝑒 = 0 𝑞 2 𝑢 = −(𝑃 ∙ 𝑂 + 𝑒)/(𝐸 ∙ 𝑂) 𝑄 = 𝑃 + 𝑢𝐸

  20. Advanced Graphics – Introduction 20 Recap Ray Intersection 𝑞 1 Ray / sphere intersection: 𝑞 0 Sphere: 𝑞 − 𝐷 ∙ 𝑞 − 𝐷 − 𝑠 2 = 0 Substituting for 𝑞(𝑢) , we get 𝐹 𝑃 + 𝑢𝐸 − 𝐷 ∙ 𝑃 + 𝑢𝐸 − 𝐷 − 𝑠 2 = 0 𝐸 ∙ 𝐸 𝑢 2 + 2𝐸 ∙ 𝑃 − 𝐷 𝑢 + (𝑃 − 𝐷) 2 −𝑠 2 = 0 𝑐 2 − 4𝑏𝑑 𝑏𝑢 2 + 𝑐𝑢 + 𝑑 = 0 → 𝑢 = −𝑐 ± 2𝑏 𝑞 2 𝑏 = 𝐸 ∙ 𝐸 Negative: 𝑐 = 2𝐸 ∙ (𝑃 − 𝐷) no intersections 𝑑 = 𝑃 − 𝐷 ∙ 𝑃 − 𝐷 − 𝑠 2

  21. Advanced Graphics – Introduction 21 Recap 𝐸 Ray Intersection Efficient ray / sphere intersection: void Sphere::IntersectSphere( Ray ray ) { vec3 c = this.pos - ray.O; float t = dot( c, ray.D ); vec3 q = c - t * ray.D; float p2 = dot( q, q ); if (p2 > sphere.r2) return; // r2 = r * r t t -= sqrt( sphere.r2 – p2 ); 𝑑 if ((t < ray.t) && (t > 0)) ray.t = t; // or: ray.t = min( ray.t, max( 0, t ) ); 𝑟 } O Note: 𝑞 2 This only works for rays that start outside the sphere.

  22. Advanced Graphics – Introduction 22 Recap Observations Ray tracing is a point sampling process:  we may miss small details;  aliasing will occur. Ray tracing is a visibility algorithm:  For each pixel, we find the nearest object (which occludes objects farther away).

  23. Advanced Graphics – Introduction 23 Recap Observations Note: Rasterization (Painter’s or z -buffer) is also a visibility algorithm. Rasterization:  loop over objects / primitives;  per primitive: loop over pixels. Ray tracing:  loop over pixels;  per pixel: loop over objects / primitives.

  24. Today’s Agenda:  Advanced Graphics  Recap: Ray Tracing  Whitted-style  Assignment 1

  25. Advanced Graphics – Introduction 25 Whitted An Improved Illumination Model for Shaded Display In 1980, “State of the Art” consisted of:  Rasterization  Shading: either diffuse (N · L) or specular ((N · H) n ), both not taking into account fall-off (Phong)  Reflection, using environment maps (Blinn & Newell *)  Stencil shadows (Williams **) Goal:  Solve reflection and refraction Improved model:  Based on classical ray optics * : Blinn, J. and Newell, M. 1976. Texture and Reflection in Computer Generated Images. Communications of the ACM 19:10 (1976), 542 — 547. ** : Williams, L. 1978. Casting curved shadows on curved surfaces. In Computer Graphics (Proceedings of SIGGRAPH 78), vol. 12, 270 – 274.

Recommend


More recommend