David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Exploration of advanced lighting and shading techniques
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Lecture 14 Illumination II – Global Models
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.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Ray Tracing Variants Distributed ray tracing Generalized rays Cone Tracing Beam Tracing Pencil.
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 박 경 와.
CSCE 641: Photon Mapping Jinxiang Chai. Outline Rendering equation Photon mapping.
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
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.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
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.
Fundamentals of Computer Graphics Part 6 Shading prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.:
CS 445 / 645: Introductory Computer Graphics
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
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.
-Global Illumination Techniques
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.
David Luebke10/9/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
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.
Real-time Graphics for VR Chapter 23. What is it about? In this part of the course we will look at how to render images given the constrains of VR: –we.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Ray-tracing.
Lecture Fall 2001 Illumination and Shading in OpenGL Light Sources Empirical Illumination Shading Transforming Normals Tong-Yee Lee.
Pure Path Tracing: the Good and the Bad Path tracing concentrates on important paths only –Those that hit the eye –Those from bright emitters/reflectors.
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
Where We Stand So far we know how to: –Transform between spaces –Rasterize –Decide what’s in front Next –Deciding its intensity and color.
CS 445 / 645 Introduction to Computer Graphics Lecture 16 Radiosity Radiosity.
CS 551/651: Advanced Computer Graphics
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.
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
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.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Bounding Volume Hierarchies and Spatial Partitioning
Bounding Volume Hierarchies and Spatial Partitioning
Unit-7 Lighting and Shading
© University of Wisconsin, CS559 Fall 2004
CMSC 635 Ray Tracing.
Fundamentals of Computer Graphics Part 6 Shading
CS 551 / 645: Introductory Computer Graphics
CSCE 441: Computer Graphics Ray Tracing
Ray Tracing Sung-Eui Yoon (윤성의) CS580: Course URL:
Chapter 14 Shading Models.
CSC418 Computer Graphics Raytracing Shadows Global Illumination.
Presentation transcript:

David Luebke3/12/2016 Advanced Computer Graphics Lecture 3: More Ray Tracing David Luebke

David Luebke3/12/2016 Administrivia Read Chapter 9 Read Chapter 9 Hand out Exercise 1 Hand out Exercise 1 Course action forms Course action forms

David Luebke3/12/2016 Illumination Model Recall: color at a surface is given by Recall: color at a surface is given by –Contribution of reflected ray (if any) –Contribution of transmitted ray (if any) –Contribution of local color In a typical ray-tracer, what determines this local color? In a typical ray-tracer, what determines this local color?

David Luebke3/12/2016 Illumination Model Local color depends on: Local color depends on: –Which light sources illuminate surface –The characteristics of the light Spectrum (approximated how?) Spectrum (approximated how?) Intensity Intensity –The material properties of the surface Color (diffuse and specular) Color (diffuse and specular) Shininess Shininess –Indirect lighting (approximated how?)

David Luebke3/12/2016 Illumination Model Local color depends on: Local color depends on: –Which light sources illuminate surface –The characteristics of the light Spectrum (approximated how?) Spectrum (approximated how?) Intensity Intensity –The material properties of the surface Color (diffuse and specular) Color (diffuse and specular) Shininess Shininess –Indirect lighting (approximated how?)

David Luebke3/12/2016 Shadow Rays Simple idea: 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 Q: how much extra work is involved? Q: how much extra work is involved? –A: each ray-surface intersection now spawns n + 2 rays, n = # light sources –Remember: intersections 95% of work

David Luebke3/12/2016 Shadow Rays What are some problems with using shadow rays as described? What are some problems with using shadow rays as described? –Lots of computation –Infinitely sharp shadows –No semitransparent object shadows

David Luebke3/12/2016 Shadow Ray Problems: Too Much Computation Light buffer (Haines/Greenberg, 86) 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! Light Buffer Occluding Polys Shadow Ray Current Intersection Point

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

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

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

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

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

David Luebke3/12/2016 Illumination Model Local color depends on: Local color depends on: –Which light sources illuminate surface –The characteristics of the light Spectrum (approximated how?) Spectrum (approximated how?) Intensity Intensity –The material properties of the surface Color (diffuse and specular) Color (diffuse and specular) Shininess Shininess –Indirect lighting (approximated how?)

David Luebke3/12/2016 Illumination Model A simple model based on Phong: A simple model based on Phong: I(P) = I local (P) + k rg (P r ) + kg t (P t ) P : intersection of point being considered P r : first hit of reflected ray from P P t : first hit of transmitted ray from P I local (P) = I a k a + I source [k d (NL) + k rl (NH) ns ] l See chapter 2 for explanation of all these constants and vectors

David Luebke3/12/2016 Illumination model l What’s wrong with this model? –Ambient term only “fakes” indirect lighting –Difficulties with soft shadows –Treats specular reflection inconsistently n Phong empirically spreads direct illumination n But traces rays from the eye exactly

David Luebke3/12/2016 Practical Ray Tracing Read Chapter 9: Practical Ray Tracing Read Chapter 9: Practical Ray Tracing Summary: Summary: –Ray tracing is too slow –Different methods to speed it up –Ways of using ray tracing selectively

David Luebke3/12/2016 Speedup Techniques Intersect rays faster Intersect rays faster Shoot fewer rays Shoot fewer rays Shoot “smarter” rays Shoot “smarter” rays

David Luebke3/12/2016 Intersect Rays Faster Bounding volumes Bounding volumes Spatial partitions Spatial partitions Reordering ray intersection tests Reordering ray intersection tests Optimizing intersection tests Optimizing intersection tests

David Luebke3/12/2016 Bounding Volumes Bounding volumes Bounding volumes –Idea: before intersecting a ray with a collection of objects, test it against one simple object that bounds the collection

David Luebke3/12/2016 Bounding Volumes Hierarchical bounding volumes Hierarchical bounding volumes –Group nearby volumes hierarchically –Test rays against hierarchy top-down

David Luebke3/12/2016 Bounding Volumes Different bounding volumes Different bounding volumes –Spheres Cheap intersection test Cheap intersection test Poor fit Poor fit Tough to calculate optimal clustering Tough to calculate optimal clustering –Axis-aligned bounding boxes (AABBs) Relatively cheap intersection test Relatively cheap intersection test Usually better fit Usually better fit Trivial to calculate clustering Trivial to calculate clustering

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

David Luebke3/12/2016 Spatial Partitioning Hierarchical bounding volumes surround objects in the scene with (possibly overlapping) volumes Hierarchical bounding volumes surround objects in the scene with (possibly overlapping) volumes Spatial partitioning techniques classify all space into non- overlapping portions Spatial partitioning techniques classify all space into non- overlapping portions

David Luebke3/12/2016 Spatial Partitioning Example spatial partitions: Example spatial partitions: –Uniform grid (2-D or 3-D) –Octree –k-D tree –BSP-tree

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

David Luebke3/12/2016 Octree Octree pros: Octree pros: –Simple to generate –Adaptive Octree cons: Octree cons: –Nontrivial to trace rays across –Adaptive only in scale

David Luebke3/12/2016 k-D Trees k-D tree pros: k-D tree pros: –Moderately simple to generate –More adaptive than octrees k-D tree cons: k-D tree cons: –Less efficient to trace rays across –Moderately complex data structure

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

David Luebke3/12/2016 Reordering Ray Intersection Tests Caching ray hits (esp. shadow rays) Caching ray hits (esp. shadow rays) Memory-coherent ray tracing Memory-coherent ray tracing More later… More later…

David Luebke3/12/2016 Optimizing Ray Intersection Tests Fine-tune the math! Fine-tune the math! –Share subexpressions –Precompute everything possible Code with care Code with care –Even use assembly, if necessary –Will get its own lecture