Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil COMP30019 Graphics and Interaction Ray Tracing Adrian Pearce Department of Computer Science and Software Engineering University of Melbourne The University of Melbourne Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Lecture outline Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Buffer Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil What alternatives are there to the rendering pipeline approach? Aim: understand the computational implications of ray tracing and the radiance illumination model. Reading: ◮ 13.4 Visible-surface ray tracing and 14.7 Recursive Ray tracing and Foley Sections 12.4.8 Shadows. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Alternative to rendering pipeline: Ray tracing Idea is simple: tracing backwards the path of each ray of light entering the camera to find out what objects it encountered, and what light sources it came from! 1. Each pixel in the created image corresponds to a line of sight. 2. Start from i mage not p olygon or object as in rendering pipeline approach. 3. We can trace back this line of sight (ray) to find the nearest object surface it intersects. At this inter point, we can check for visibility of light sources, and compute Lambertian, ambient, and specular contributions to our ray. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Recursive rays T 2 N i Surface normal R 2 N 2 R 3 T 1 R i Reflected ray N 3 R 1 L i Shadow ray L 3 T i Transmitted ray L 2 L 1 N 1 Point light source Viewpoint (Foley Figure 14.35) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil fxguide: A SSS render using Lightstage data Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Real-time ray tracing? The cardinality (or size) of the ray tracing problem is determined by the number of pixels in the image or viewport, as opposed to the number of polygons in the scene as in the rendering pipeline approach. In addition, ray tracing is made more computationally intensive by the recursive nature of ray tracing (depending upon what order you assume in terms of how many re-reflections of rays you cater for). Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Octane Render: raltime ray tracing Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Octane Render: realtime ray tracing Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Some real-time ray tracing techiques Quite a large number of approaches to speed up. ◮ Pre-baking, ◮ OpenRL (low level interactive ray tracing API), ◮ Bounding volumes, e.g. Binary space parition trees (BSPs) ◮ . . . Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil World space scene intersection in Unity 5 http://www.gdcvault.com/play/1020688/ Practical-Techniques-for-Ray-Tracing Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Binary Space Partition (BSP) Trees Binary partition sort (akin to quicksort): ◮ Choose a face ◮ Partition other faces into those closer or farther than the plane of this face (cutting faces where they straddle the partitioning plane) ◮ Recursively work on the partitions, until single faces Note: This partitioning structure (tree) is invariant to change of viewpoint Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil A BSP tree representation in two-dimensions (2D) a b j d c c e k out b g d out f g in out i e in out in out h out h f k in i j a in out (a) (b) (a) A concave polygon bounded by black lines.(b) The BSP tree. Foley Figure 10.19 ◮ Lines defining the half-spaces are dark grey, and in cells are light grey. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil The BSP tree algorithm is an extremely efficient method for calculating the visibility relationships among a static group of 3D polygons as seen from an arbitrary viewpoint. ◮ Remarkably, the BSP tree can be traversed in a modified in-order tree walk to yield a correct priority ordered polygon list. ◮ Based on relationship to polygons surface normal. ◮ unlike other approaches where data structures need re-calculating (note, if using z-buffering, or scan-line variant rely on sortedness of polygons, and as viewpoint changes will need to re-sort these lists. ◮ Downside: need to pre-process all polygons. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Refraction When going from one medium to another, a ray of light will be bent at the intermediate surface. This bending, refraction , is governed by Snell’s Law: sin θ i = η t λ sin θ t η i λ where θ i is the angle of incidence, θ t is the angle of refraction and η t λ and η i λ are the indices of refraction of each material as a function of wavelength λ . Notice that, for a solid piece of transparent material, light will be refracted both on entering and leaving the material. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Calculating the Refraction vector N N cos θ i – I I N cos θ i θ i sin θ t M M = ( N cos θ i – I ) /sin θ i θ t –cos θ t N T = sin θ t M – cos θ t N – N (Foley Figure 14.32) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Transparency Some of this loss is from reflection at the surfaces as the light enters and leaves the object. This is the factor t . The rest of the loss is from absorption within the transparent material. A constant increase in path length within the material reduces the light by a constant factor, leading to an exponential behaviour. T = te − ad where a is parameter, and d is the distance travelled within the material. Note, because light may take an oblique path, the distance d is not usually the same as the thickness of the material. Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Ray tracing Recursive Ray Tracing Binary Space Partition (BSP) Trees Refraction Transparency Shadow volumes & the Stencil Shadow volumes & the Stencil Buffer Light Object C B A A front facing shadow polygon , A or B in above Figure, causes polygons behind it to be shadowed. (Foley Figure 14.28) Adrian Pearce University of Melbourne COMP30019 Graphics and InteractionRay Tracing
Recommend
More recommend