第五课 Ray Tracing. Overview of the Section Why Ray Tracing? What is Ray Tracing? How to tracing rays? How to accelerating ray-tracing?

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

GR2 Advanced Computer Graphics AGR
13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Ray Tracing Ray Tracing 1 Basic algorithm Overview of pbrt Ray-surface intersection (triangles, …) Ray Tracing 2 Brute force: Acceleration data structures.
Ray Tracing CMSC 635. Basic idea How many intersections?  Pixels  ~10 3 to ~10 7  Rays per Pixel  1 to ~10  Primitives  ~10 to ~10 7  Every ray.
Visibility Culling. Back face culling View-frustrum culling Detail culling Occlusion culling.
Illumination Model & Surface-rendering Method 박 경 와.
Christian Lauterbach COMP 770, 2/11/2009
Chapter 11: Advanced Rendering Part 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Ray Tracing Acceleration Structures Solomon Boulos 4/16/2004.
Tomas Mőller © 2000 Speeding up your game The scene graph Culling techniques Level-of-detail rendering (LODs) Collision detection Resources and pointers.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
RAY TRACING.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 14: Ray Tracing
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
Ray Tracing 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Estruturas de Dados Espaciais MC-930 MO-603. Speeding Up Ray Tracing.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 2: Basic Ray Tracing Ravi Ramamoorthi Some slides courtesy.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
Hidden Surface Removal
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
COMP 175: Computer Graphics March 24, 2015
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
David Luebke10/9/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
On a Few Ray Tracing like Algorithms and Structures. -Ravi Prakash Kammaje -Swansea University.
Real-Time Rendering SPEEDING UP RENDERING Lecture 04 Marina Gavrilova.
Visible-Surface Detection Jehee Lee Seoul National University.
Foundations of Computer Graphics (Spring 2012) CS 184, Lectures 16, 18: Nuts and bolts of Ray Tracing Acknowledgements:
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.
Recursion and Data Structures in Computer Graphics Ray Tracing 1.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Hierarchical Penumbra Casting Samuli Laine Timo Aila Helsinki University of Technology Hybrid Graphics, Ltd.
Basic Ray Tracing CMSC 435/634.
Ray Tracing. 2 Introduction OpenGL is based on a pipeline model in which primitives are rendered one at time ­No shadows (except by tricks or multiple.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
Ray Tracing II. HW1 Part A due October 10 Camera module Object module –Read from a file –Sphere and Light only Ray tracer module: –No shading. No reflection.
Maths & Technologies for Games Spatial Partitioning 2
Advanced topics Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2006/01/04 with slides by Brian Curless, Zoran Popovic, Mario Costa Sousa.
CSCE 441: Computer Graphics Ray Tracing
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2015.
CSE554Contouring IISlide 1 CSE 554 Lecture 5: Contouring (faster) Fall 2013.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
David Luebke2/23/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Ray Tracing Optimizations
David Luebke 3/5/2016 Advanced Computer Graphics Lecture 4: Faster Ray Tracing David Luebke
RENDERING : Global Illumination
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
Ray Tracing Acceleration (1). Acceleration of Ray Tracing Goal: Reduce the number of ray/primitive intersections.
Solid Modeling Dr. Scott Schaefer.
3D Object Representations 2009, Fall. Introduction What is CG?  Imaging : Representing 2D images  Modeling : Representing 3D objects  Rendering : Constructing.
Ray Tracing Acceleration (3)
CSE 554 Lecture 5: Contouring (faster)
CSE 167 [Win 17], Lecture 15: Ray Tracing Ravi Ramamoorthi
Real-Time Ray Tracing Stefan Popov.
CSCE 441: Computer Graphics Ray Tracing
GR2 Advanced Computer Graphics AGR
Presentation transcript:

第五课 Ray Tracing

Overview of the Section Why Ray Tracing? What is Ray Tracing? How to tracing rays? How to accelerating ray-tracing?

Object-ordering rendering Each polygon or triangle is processed in turn and its visibility is determined using algorithms such as Z-buffer After determining its visibility, the polygon or triangle is projected onto the viewing plane Polygon or triangle is shaded using Phong Model\ OpenGL, rasterization ( 光栅化 )

Object-ordering rendering Advantage  Fast rendering can be implemented on hardware Disadvantage  Difficult to model lighting effects such as reflection or transparency  Difficult to model lighting effects are caused by the interaction of objects, i.e. shadows Assumption  Light travels from visible objects towards the eye

Ray tracing Question  Do light proceed from the eye to the light source or from light source to the eye? To answer the question, it’s important to understand  Light rays do travel in straight lines  Light rays do not interfere if they cross  Light rays travel from the light source to the eye but the physics are invariant under path reversal

Ray tracing Image order rendering  Start from pixel, what do you see through this pixel Allows to add more realism to the rendered scene by allowing effects such as  Shadows  Transparency  Reflections

How ray-tracing works Looks through each pixel (e.g. 640 x 480) Determines what eye sees through pixel  Trace light ray: eye -> pixel (image plane) -> scene  If a ray intersect any scene object? Yes, render pixel using object color No, it uses the background color  Automatically solves hidden surface removal problem

Ray misses all objects

Ray hits an object

Ray hits object: Check if hit point is in shadow, build secondary ray towards light sources

Ray hits an object If shadow ray hits another object before light source: first intersection point is in shadow of the second object. Otherwise, collect light contributions

Reflected Ray When a ray hits an reflective object, a reflection ray is generated which is tested against all of the object in the scene

Shadows and Reflections

Transparency If intersected object is transparent, transmitted ray is generated

Transparency

Recursion Reflected rays can generated other reflected rays

Recursion Scene with one layer of reflection

Recursion Scene with two layer of reflection

Ray Tree Reflective/transmitted rays are continually generated until ray leaves the scene without hitting any object or a preset recursion level has been reached

Ray-Object Intersections Express ray as equation (origin is eye, pixel determines direction)  R0 = [x0, y0, z0] – origin of ray  Rd = [xd, yd, zd] – direction of ray Define parametric equation of ray  R (t) = R0 + Rd * t, with t > 0.0 Express all objects mathematically Ray tracing idea:  Put ray mathematical equation into object equation  Determine if real solution exists  Object with smallest hit time is object seen

Ray-Object Intersection Dependent on parametric equation of object Ray-Sphere Intersections Ray-Plane Intersections Ray-Polygon Intersections Ray-Box Intersections Ray-Quadric Intersections (cylinders, cones, ellipsoids, paraboloids)

Accelerating Ray Tracing Ray tracing is very time-consuming because of intersection calculations Each intersection requires many floating float point operations Solutions  Use faster machines  Use specialized hardware, especially parallel processors  Speed up computations by using more efficient algorithms  Reduce the number of ray-object computations

Reducing Ray-Object Intersections We will look at spatial ( 空间的 ) data structures  Hierarchical ( 层次 ) bounding volumes ( 包围盒 )  Uniform Grids ( 均匀格 )  Quadtree/Octree ( 四叉树 / 八叉树 )  K-d Tree/BSP tree ( 空间二分树 ) Good spatial data structures could speed up ray tracing by times

Ray intersection

Ray Intersection

Bounding Volume Wrap ( 包住 ) things with bound volumes that hard to test for intersection in things that are easy to test. Ray can’t hit the real object unless it hits the bounding volume Bounding Box and Bounding Sphere

Bounding Volume

Hierarchical Bounding Volume HBV ( 层次包围盒 )  Limitation of bounding volume Still need to test ray against every object, O(n) time complexity, where n is the number of objects  A natural extension to bounding volumes is a HBV

HBV Given the bounding volumes of the objects in the scene, a tree data structure of bounding volumes is created with the bounding volume of the objects at the leaves Each interior node v of HBV corresponds to the bounding volumes that completely encloses the bounding volumes of all the children node of v

HBV An example  Several triangles (right)  HBV (below)

HBV

Works well if you use good bounding volume and hierarchy Should give O(logn) time complexity Can have mulitple classes (box, sphere) of bounding volumes

Uniform Grids ( 均匀网格 ) Data structure: a 3D array of cells that tile space  Each cell lists all primitives which intersect with that cell

Uniform Grids Intersection testing  Start tracing at cell where ray begins  Step from cell to cell, searching for the first intersection cell  At each cell, test for intersection with all primitives intersected with that cell  If there is an intersection, return the closest one

Uniform Grids Advantage  Easy to construct and easy to traverse Disadvantage  Uniform grids are a poor choice if the world is non-homogeneous ( 不均匀 ). Many polygons will cluster in a small space  How many cells to use? Too few -> many objects in a cell -> slow Too many -> many empty cells to traverse -> slow and large storage  Non-uniform spatial division is better

QuadTree/Octree QuadTree  The 2D generalization of binary tree  Node is a square  Recursively split square into four equal sub- square  Stop when leaves get “simple enough” Octree  2D generalization of QuadTree  Node is cube, recursively split into 8 equal sub- cubes

Construction of Octree First, enclose the entire scene in a minimal axis-aligned box Built recursively in a top-down fashion, and stops recursion when criterion is fulfilled These criteria include: a maximum number of recursion level has been reached, or that there is fewer than a threshold number of primitives in a node. ( 递归终止条件:已达到最大层次、或包围盒 内物体已很少 )

BSP tree

Construction of BSP Similar to octree, BSP is also constructed hierarchically in top- down fashion  A splitting plane (perpendicular to axis x or y or z) is selected to subdivide a current leaf node into two equal size sub-nodes

BSP tree Examples

KD-tree Difference between BSP and KD tree  Distinguished by the position of the splitting plane: in BSP tree, the plane always lies at the mid-point of the current node, but the KD tree has arbitrarily position of the plane Thus, any BSP tree is a KD tree, but not vice versa

Thanks