Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Similar documents
Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Acceleration Data Structures

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Spatial Data Structures

Spatial Data Structures and Speed-Up Techniques. Ulf Assarsson Department of Computer Science and Engineering Chalmers University of Technology

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Spatial Data Structures

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Spatial Data Structures and Acceleration Algorithms

Spatial Data Structures

Spatial Data Structures

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

Recall: Indexing into Cube Map

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Ray Tracing Acceleration Data Structures

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Computer Graphics Ray Casting. Matthias Teschner

Speeding up your game

Spatial Data Structures

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

CPSC GLOBAL ILLUMINATION

Sung-Eui Yoon ( 윤성의 )

COMP 175: Computer Graphics April 11, 2018

Intro to Ray-Tracing & Ray-Surface Acceleration

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project

Ray Tracing. Foley & Van Dam, Chapters 15 and 16

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Effects needed for Realism. Computer Graphics (Fall 2008) Ray Tracing. Ray Tracing: History. Outline

Computer Graphics. Si Lu. Fall uter_graphics.htm 11/22/2017

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

Accelerated Raytracing

Acceleration Data Structures. Michael Doggett Department of Computer Science Lund university

Accelerating Ray-Tracing

Ray Tracing. Outline. Ray Tracing: History

Effects needed for Realism. Ray Tracing. Ray Tracing: History. Outline. Foundations of Computer Graphics (Spring 2012)

Spatial Data Structures and Acceleration Algorithms

Ray Casting. Outline in Code. Outline. Finding Ray Direction. Heckbert s Business Card Ray Tracer. Foundations of Computer Graphics (Fall 2012)

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL:

Global Rendering. Ingela Nyström 1. Effects needed for realism. The Rendering Equation. Local vs global rendering. Light-material interaction

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Accelerating Ray Tracing

Intersection Acceleration

Ray Tracing. CS334 Fall Daniel G. Aliaga Department of Computer Science Purdue University

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Acceleration. Welcome!

CS 465 Program 5: Ray II

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Graphics 2009/2010, period 1. Lecture 8: ray tracing

Assignment 6: Ray Tracing

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Ray Casting. To Do. Outline. Outline in Code. Foundations of Computer Graphics (Spring 2012) Heckbert s Business Card Ray Tracer

Ray Tracing. Kjetil Babington

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

VIII. Visibility algorithms (II)

Ray Tracing II. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Ray Tracing: Intersection

Ray Tracing Acceleration. CS 4620 Lecture 20

COMP371 COMPUTER GRAPHICS

CS535 Fall Department of Computer Science Purdue University

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Recursion and Data Structures in Computer Graphics. Ray Tracing

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Computer Graphics. Bing-Yu Chen National Taiwan University

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Ray Intersection Acceleration

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

COMPUTER GRAPHICS COURSE. Ray Tracing

Review for Ray-tracing Algorithm and Hardware

Photorealistic 3D Rendering for VW in Mobile Devices

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Lecture 11. More Ray Casting/Tracing

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ]

Computer Graphics. - Ray-Tracing II - Hendrik Lensch. Computer Graphics WS07/08 Ray Tracing II

CHAPTER 1 Graphics Systems and Models 3

Lecture 11: Ray tracing (cont.)

Photorealism: Ray Tracing

Hidden Surface Elimination Raytracing. Pre-lecture business. Outline for today. Review Quiz. Image-Space vs. Object-Space

1999, Denis Zorin. Ray tracing

improving raytracing speed

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

CS 4620 Program 4: Ray II

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Lecture 8 Ray tracing Part 1: Basic concept Yong-Jin Liu.

Lecture 18 of 41. Scene Graphs: Rendering Lab 3b: Shader

Advanced 3D-Data Structures

Ray Tracer I: Ray Casting Due date: 12:00pm December 3, 2001

Computer Graphics. - Spatial Index Structures - Philipp Slusallek

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Solid Modeling. Thomas Funkhouser Princeton University C0S 426, Fall Represent solid interiors of objects

Ray Tracer Due date: April 27, 2011

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

Transcription:

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI)

Raytracing Global illumination-based rendering method Simulates rays of light, natural lighting effects Because light path is traced, handles effects tough for opengl: Shadows Multiple inter-reflections Transparency Refraction Texture mapping Newer variations e.g. photon mapping (caustics, participating media, smoke) Note: raytracing can be semester graduate course Today: start with high-level description

Raytracing Uses Entertainment (movies, commercials) Games (pre-production) Simulation (e.g. military) Image: Internet Ray Tracing Contest Winner (April 2003)

Ray Casting (Appel, 1968) direct illumination OpenGL does this too

How Raytracing Works OpenGL is object space rendering start from world objects, rasterize them Ray tracing is image space method Start from pixel, what do you see through this pixel? Looks through each pixel (e.g. 640 x 480) Determines what eye sees through pixel Basic idea: Trace light rays: eye -> pixel (image plane) -> scene If a ray intersect any scene object in this direction Yes? render pixel using object color No? it renders the pixel using the background color Automatically solves hidden surface removal problem

Case A: Ray misses all objects

Case B: Ray hits an object

Case B: Ray hits an object Ray hits object: Check if hit point is in shadow, build secondary ray (shadow ray) towards light sources.

Case B: 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

Case B: Ray hits an object First Intersection point in the shadow of the second object is the shadow area.

Reflected Ray When a ray hits an object, a reflected ray is generated which is tested against all of the objects in the scene.

Reflection: Contribution from the reflected ray

Transparency If intersected object is transparent, transmitted ray is generated and tested against all the objects in the scene.

Transparency: Contribution from transmitted ray

Reflected Ray: Recursion Reflected rays can generate other reflected rays that can generate other reflected rays, etc. Case A: Scene with no reflection rays

Reflected Ray: Recursion Case B: Scene with one layer of reflection

Reflected Ray: Recursion Case C: Scene with two layers of reflection

Ray Tree Reflective and/or 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 So, express ray as equation (origin is eye, pixel determines direction) Define a ray as: R0 = [x0, y0, z0] - origin of ray Rd = [xd, yd, zd] - direction of ray then define parametric equation of ray: R(t) = R0 + Rd * t with t > 0.0 Express all objects (sphere, cube, etc) 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 Intersections Dependent on parametric equations 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 time-consuming because of intersection calculations Each intersection requires from a few (5-7) to many (15-20) floating point (fp) operations Example: for a scene with 100 objects and computed with a spatial resolution of 512 x 512, assuming 10 fp operations per object test there are about 250,000 X 100 X10 = 250,000,000 fps. Solutions: Use faster machines Use specialized hardware, especially parallel processors or graphics card Speed up computations by using more efficient algorithms Reduce the number of ray - object computations

Reducing Ray-Object Intersections Adaptive Depth Control: Stop generating reflected/transmitted rays when computed intensity becomes less than certain threshold. Bounding Volumes: Enclose groups of objects in sets of hierarchical bounding volumes First test for intersection with the bounding volume Then only if there is an intersection, against the objects enclosed by the volume. First Hit Speed-Up: use modified Z-buffer algorithm to determine the first hit.

Popular Spatial Acceleration Structures Spatial Data Structures: manage scene geometry Bounding Volume Hierarchies BSP Trees Octrees Scene Graphs

How? Organizes geometry in some hierarchy In 2D space Data structure Bounding Volume Hierachy

What s the point? An example Assume we click on screen, and want to find which object we clicked on click! 1) Test the root first 2) Descend recursively as needed 3) Terminate traversal as soon as possible In general: get O(log n) instead of O(n)

Bounding Volume Hierarchy (BVH) Use simple shapes to enclose complex geometry Most common bounding volumes (BVs): Spheres, boxes (AABB and OBB) The BV does not contibute to the rendered image - - rather, encloses an object The data structure is a k-ary tree Leaves hold geometry Internal nodes have at most k children Internal nodes hold BVs that enclose all geometry in its subtree

Example Application of BVH: Intersection Testing in RT Enclose scene geometry in BVH Cube/box much easier to test for intersections Large time savings if ray misses portions of scene

Axis-Aligned BSP tree General idea: Divide space with a plane Sort geometry into the space it belongs Can only make a splitting plane along x,y, or z Minimal box Split along plane Split along plane Split along plane

Axis-Aligned BSP tree B D E 0 A Plane 1a Plane 0 Plane 2 Plane 1b C A 1a B 1b C 2 D E Each internal node holds a divider plane Leaves hold geometry Differences compared to BVH Encloses entire space BVHs can use any desirable type of BV

Octrees Similar to axis-aligned BSP trees but regular Will explain the quadtree, which is the 2D variant of an octree In 3D each square (or rectangle) becomes a box, and 8 children

Example of Octrees

References Hill and Kelley, Computer Graphics using OpenGL, 3 rd edition, Chapter 12 Akenine-Moller, Eric Haines and Naty Hoffman, Real Time Rendering (3 rd edition)