David Luebke10/9/2015 CS 551 / 645: Introductory Computer Graphics David Luebke

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

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 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.
3D Graphics Rendering and Terrain Modeling
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
David Luebke1/19/99 CS 551/651: Advanced Computer Graphics David Luebke
Week 14 - Monday.  What did we talk about last time?  Bounding volume/bounding volume intersections.
Illumination Model & Surface-rendering Method 박 경 와.
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
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.
Bounding Volume Hierarchies and Spatial Partitioning Kenneth E. Hoff III COMP-236 lecture Spring 2000.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 14: Ray Tracing
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
CSC418 Computer Graphics n Raytracing n Shadows n Global Illumination.
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.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
12/05/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling Very brief intro to global illumination.
1 Speeding Up Ray Tracing Images from Virtual Light Field Project ©Slides Anthony Steed 1999 & Mel Slater 2004.
Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand.
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
Graphics Graphics Korea University cgvr.korea.ac.kr Solid Modeling 고려대학교 컴퓨터 그래픽스 연구실.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
1 Shadows (2) ©Anthony Steed Overview n Shadows – Umbra Recap n Penumbra Analytical v. Sampling n Analytical Aspect graphs Discontinuity meshing.
1 Dr. Scott Schaefer Ray Tracing. 2/42 Ray Tracing Provides rendering method with  Refraction/Transparent surfaces  Reflective surfaces  Shadows.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Collaborative Visual Computing Lab Department of Computer Science University of Cape Town Graphics Topics in VR By Shaun Nirenstein.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
第五课 Ray Tracing. Overview of the Section Why Ray Tracing? What is Ray Tracing? How to tracing rays? How to accelerating ray-tracing?
Ray-tracing.
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.
Bounding Volume Hierarchy. The space within the scene is divided into a grid. When a ray travels through a scene, it only passes a few boxes within the.
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
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
CS 551/651: Advanced Computer Graphics
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
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
CSE 681 Introduction to Ray Tracing. CSE 681 Ray Tracing Shoot a ray through each pixel; Find first object intersected by ray. Image plane Eye Compute.
Ray Tracing Acceleration (5). Ray Tracing Acceleration Techniques Too Slow! Uniform grids Spatial hierarchies K-D Octtree BSP Hierarchical grids Hierarchical.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
Ray Tracing Acceleration (1). Acceleration of Ray Tracing Goal: Reduce the number of ray/primitive intersections.
Bounding Volume Hierarchies and Spatial Partitioning
CSE 167 [Win 17], Lecture 15: Ray Tracing Ravi Ramamoorthi
Bounding Volume Hierarchies and Spatial Partitioning
Ray Tracing Dr. Scott Schaefer.
3D Graphics Rendering PPT By Ricardo Veguilla.
© University of Wisconsin, CS559 Fall 2004
CMSC 635 Ray Tracing.
CS 551 / 645: Introductory Computer Graphics
CSCE 441: Computer Graphics Ray Tracing
GR2 Advanced Computer Graphics AGR
CSC418 Computer Graphics Raytracing Shadows Global Illumination.
Presentation transcript:

David Luebke10/9/2015 CS 551 / 645: Introductory Computer Graphics David Luebke

David Luebke10/9/2015 Administrivia l Upcoming graphics events –Graphics lunch: Olsson 236D n Ongoing, informal event; bring your lunch –“Graphics week”: 2 upcoming colloquia n Dec 1: Dan Aliaga (Bell Labs), Image-Based Rendering n Dec 6: Ben Watson (U. Alberta), Level of detail control

David Luebke10/9/2015 Recap: Ray Casting l An example: ScreenEyepointScene

David Luebke10/9/2015 Recap: Recursive Ray Tracing l Obvious extension: –Spawn additional rays off reflective surfaces –Spawn transmitted rays through transparent surfaces l Leads to recursive ray tracing Primary Ray Secondary Rays

David Luebke10/9/2015 Recap: Basic Algorithm Object allObs[]; Color image[]; RayTraceScene() allObs = initObjects(); for (Y  all rows in image) for (X  all pixels in row) Ray R = calcPrimaryRay(X,Y); image[X,Y] = TraceRay(R); display(image);

David Luebke10/9/2015 Recap: Basic Algorithm Color TraceRay(Ray R) if rayHitsObjects(R) then Color localC, reflectC, refractC; Object O = findNearestObject(R); localC = shade(O,R); Ray reflectedRay = calcReflect(O,R) Ray refractedRay = calcRefract(O,R) reflectC = TraceRay(reflectedRay); refractC = TraceRay(refractedRay); return localC  reflectC  refractC else return backgroundColor

David Luebke10/9/2015 Recap: Representing Rays l We represent a ray parametrically: –A starting point O –A direction vector D –A scalar t O D t = 1t < 0 R = O + tD t > 1

David Luebke10/9/2015 Recap: Ray-Polygon Intersection Find plane equation of polygon: ax + by + cz + d = 0 l To find coefficients: N = [a, b, c] d = N  P 1 x y N P1P1 P2P2 d

David Luebke10/9/2015 Recap: Ray-Polygon Intersection l Find intersection of ray and plane: t = -(aO x + bO y + cO z + d) / (aD x + bD y + cD z ) Does polygon contain intersection point P i ? –One simple algorithm: Draw line from P i to each polygon vertex n Measure angles between lines (how?) If sum of angles between lines is 360°, polygon contains P i –Slow — better algorithms available

David Luebke10/9/2015 Recap: Shadow Rays l Simple idea: –Where a ray intersects a surface, send a shadow ray to each light source –If the shadow ray hits any surface before the light source, ignore light l Note: each ray-surface intersection now spawns n + 2 rays, n = # light sources –Remember: intersections 95% of work

David Luebke10/9/2015 Recap: Shadow Rays l Some problems with using shadow rays as described: –Lots of computation –Infinitely sharp shadows –No semitransparent object shadows

David Luebke10/9/2015 Shadow Ray Problems: Too Much Computation l Light buffer (Haines/Greenberg, 86) –Precompute lists of polygons surrounding light source in all directions –Sort each list by distance to light source –Now shadow ray need only be intersected with appropriate list! Occluding Polys Shadow Ray Current Intersection Point Light Buffer

David Luebke10/9/2015 Shadow Rays l Some problems with using shadow rays as described: –Lots of computation –Infinitely sharp shadows –No semitransparent object shadows

David Luebke10/9/2015 Shadow Ray Problems: Sharp Shadows l Why are the shadows sharp? l A: Infinitely small point light sources l What can we do about it? l A: Implement area light sources l How?

David Luebke10/9/2015 Shadow Ray Problems: Area Light Sources 30% blockage l Could trace a conical beam from point of intersection to light source: l Track portion of beam blocked by occluding polygons:

David Luebke10/9/2015 Shadow Ray Problems: Area Light Sources l Too hard! Approximate instead: l Sample the light source over its area and take weighted average: 50% blockage

David Luebke10/9/2015 Shadow Ray Problems: Area Light Sources l Disadvantages: –Less accurate (50% vs. 30% blockage) –Oops! Just quadrupled (at least) number of shadow rays l Moral of the story: –Soft shadows are very expensive in ray tracing

David Luebke10/9/2015 Shadow Rays l Some problems with using shadow rays as described: –Lots of computation –Infinitely sharp shadows –No semitransparent object shadows

David Luebke10/9/2015 Shadow Ray Problems: Semitransparent Objects l In principle: –Translucent colored objects should cast colored shadows –Translucent curved objects should create refractive caustics l In practice: –Can fake colored shadows by attenuating color with distance –Caustics need backward ray tracing

David Luebke10/9/2015 Speedup Techniques l Intersect rays faster l Shoot fewer rays l Shoot “smarter” rays

David Luebke10/9/2015 Speedup Techniques l Intersect rays faster l Shoot fewer rays l Shoot “smarter” rays

David Luebke10/9/2015 Intersect Rays Faster l Bounding volumes l Spatial partitions l Reordering ray intersection tests l Optimizing intersection tests

David Luebke10/9/2015 Bounding Volumes l Bounding volumes –Idea: before intersecting a ray with a collection of objects, test it against one simple object that bounds the collection

David Luebke10/9/2015 Bounding Volumes l Hierarchical bounding volumes –Group nearby volumes hierarchically –Test rays against hierarchy top-down

David Luebke10/9/2015 Bounding Volumes l Different bounding volumes –Spheres n Cheap intersection test n Poor fit n Tough to calculate optimal clustering –Axis-aligned bounding boxes (AABBs) n Relatively cheap intersection test n Usually better fit n Trivial to calculate clustering

David Luebke10/9/2015 Bounding Volumes l More bounding volumes –Oriented bounding boxes (OBBs) n Medium-expensive intersection test n Very good fit (asymptotically better) n Medium-difficult to calculate clustering –Slabs (parallel planes) n Comparatively expensive n Very good fit n Difficult to calculate good clustering

David Luebke10/9/2015 Spatial Partitioning l Hierarchical bounding volumes surround objects in the scene with (possibly overlapping) volumes l Spatial partitioning techniques classify all space into non-overlapping portions

David Luebke10/9/2015 Spatial Partitioning l Example spatial partitions: –Uniform grid (2-D or 3-D) –Octree –k-D tree –BSP-tree

David Luebke10/9/2015 Uniform Grid l Uniform grid pros: –Very simple and fast to generate –Very simple and fast to trace rays across (How?) l Uniform grid cons: –Not adaptive n Wastes storage on empty space n Assumes uniform spread of data

David Luebke10/9/2015 Octree l Octree pros: –Simple to generate –Adaptive l Octree cons: –Nontrivial to trace rays across –Adaptive only in scale

David Luebke10/9/2015 k-D Trees l k-D tree pros: –Moderately simple to generate –More adaptive than octrees l k-D tree cons: –Less efficient to trace rays across –Moderately complex data structure

David Luebke10/9/2015 BSP Trees l BSP tree pros: –Extremely adaptive –Simple & elegant data structure l BSP tree cons: –Very hard to create optimum BSP –Splitting planes can explode storage –Simple but slow to trace rays across

David Luebke10/9/2015 Reordering Ray Intersection Tests l Caching ray hits (esp. shadow rays) l Memory-coherent ray tracing

David Luebke10/9/2015 Optimizing Ray Intersection Tests l Fine-tune the math! –Share subexpressions –Precompute everything possible l Code with care –Even use assembly, if necessary