Computer Graphics. - Ray Tracing I - Marcus Magnor Philipp Slusallek. Computer Graphics WS05/06 Ray Tracing I

Similar documents
Computer Graphics. - Introduction to Ray Tracing - Philipp Slusallek

CS348B Lecture 2 Pat Hanrahan, Spring Greeks: Do light rays proceed from the eye to the light, or from the light to the eye?

Intro to Ray-Tracing & Ray-Surface Acceleration

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

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

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

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

Photorealism: Ray Tracing

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

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

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

Sung-Eui Yoon ( 윤성의 )

CPSC GLOBAL ILLUMINATION

Introduction to Visualization and Computer Graphics

Supplement to Lecture 16

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

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

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

Illumination Algorithms

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

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

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Rendering Part I (Basics & Ray tracing) Lecture 25 December 1, 2015

COMP371 COMPUTER GRAPHICS

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

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline

Lecture 10: Ray tracing

Lighting and Shading

Questions??? Announcements Assignment 3 due today

Ray-Tracing. Misha Kazhdan

Global Illumination The Game of Light Transport. Jian Huang

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

782 Schedule & Notes

A Brief Overview of. Global Illumination. Thomas Larsson, Afshin Ameri Mälardalen University

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

Global Illumination. COMP 575/770 Spring 2013

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

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

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

Ray Tracing. Outline. Ray Tracing: History

Review for Ray-tracing Algorithm and Hardware

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

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

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

The Rendering Equation. Computer Graphics CMU /15-662

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Other Rendering Techniques CSE 872 Fall Intro You have seen Scanline converter (+z-buffer) Painter s algorithm Radiosity CSE 872 Fall

Ray Tracing. Brian Curless CSEP 557 Fall 2016

03 RENDERING PART TWO

The Rendering Equation & Monte Carlo Ray Tracing

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Recursion and Data Structures in Computer Graphics. Ray Tracing

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

Advanced Graphics. Path Tracing and Photon Mapping Part 2. Path Tracing and Photon Mapping

The Traditional Graphics Pipeline

CHAPTER 1 Graphics Systems and Models 3

Raytracing CS148 AS3. Due :59pm PDT

Lecture 11: Ray tracing (cont.)

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

Rendering Light Reflection Models

Ray Tracing. Kjetil Babington

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

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

MIT Ray Tracing Ray Tracing

Computer Graphics Ray Casting. Matthias Teschner

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

Shading, Advanced Rendering. Week 7, Wed Feb 28

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Introduction to Computer Graphics 7. Shading

CS 464 Review. Review of Computer Graphics for Final Exam

CS5620 Intro to Computer Graphics

Illumination. The slides combine material from Andy van Dam, Spike Hughes, Travis Webb and Lyn Fong

Luxo Jr. (Pixar, 1986) Last Time. Real Cameras and Ray Tracing. Standard Rasterization. Lights, Cameras, Surfaces. Now Playing:

Simple Lighting/Illumination Models

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

Interactive Methods in Scientific Visualization

Global Illumination. Global Illumination. Direct Illumination vs. Global Illumination. Indirect Illumination. Soft Shadows.

The exam begins at 2:40pm and ends at 4:00pm. You must turn your exam in when time is announced or risk not having it accepted.

Final Project: Real-Time Global Illumination with Radiance Regression Functions

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

Monte Carlo Ray-tracing and Rendering

COMP30019 Graphics and Interaction Ray Tracing

Ray Tracing. CPSC 453 Fall 2018 Sonny Chan

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

MIT Monte-Carlo Ray Tracing. MIT EECS 6.837, Cutler and Durand 1

Geometric optics. The University of Texas at Austin CS384G Computer Graphics Don Fussell

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Raytracing. COSC 4328/5327 Scott A. King

CS-184: Computer Graphics. Administrative

Ray Tracing. Shandong University

A Little Background. Motivation. Motivation

Local vs. Global Illumination & Radiosity

Models and Architectures

Transcription:

Computer Graphics - Ray Tracing I - Marcus Magnor Philipp Slusallek

Overview Last Lecture Introduction Today Ray tracing I Background Basic ray tracing What is possible? Recursive ray tracing algorithm Next lecture Ray tracing II: Spatial indices

Current Graphics: Rasterization Primitive operation of all interactive graphics!! Scan convert a single triangle at a time Sequentially processes every triangle individually Can never access more than one triangle But most effects need access to the world: shadows, reflection, global illumination

Tracing the Paths of Light Nature: Follow the path of many photons Record those hitting the film in a camera

Ingredients Surfaces 3D geometry of objects in a scene Surface reflectance characteristics Color, absorption, reflection, refraction, subsurface scattering Local property, may vary over surface Mirror, glass, glossy, diffuse, Illumination Position, characteristics of light emitters Repeatedly reflected light indirect illumination Assumption: air/empty space is totally transparent Excludes any scattering effects in participating media volumes Would require solving a much more complex problem Volume rendering, participating media

Light Transport Light Distribution in a Scene Dynamic equilibrium Newly created, scattered, and absorbed photons Forward Light Transport: Start at the light sources Shoot photons into scene Reflect at surfaces (according to some reflection model) Wait until they are absorbed or hit the camera (very seldom) Nature: massive parallel processing at the speed of light Backward Light Transport: Start at the camera Trace only paths that transport light towards the camera Ray tracing

Ray Tracing The Ray Tracing Algorithm One of the two fundamental rendering algorithms Simple and intuitive Easy to understand and implement Powerful and efficient Many optical global effects: shadows, reflection, refraction, and other Efficient real-time implementation in SW and HW Scalability Can work in parallel and distributed environments Logarithmic scalability with scene size: O(log n) vs. O(n) Output sensitive and demand driven Not new Light rays: Empedocles (492-432 BC), Renaissance (Dürer, 1525) Uses in lens design, geometric optics, Dürer, 1525

Ray Tracing Highly Realistic Images Ray tracing enables correct simulation of light transport Internet Ray Tracing Competition, June 2002

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing Pipeline Ray-Generation Ray-Traversal Intersection Shading Framebuffer

Ray Tracing - Global effects - Parallel (as nature) - Fully automatic - Demand driven - Per pixel operations - Highly efficient Fundamental Technology for Next Generation Graphics

Ray Tracing In the Past Only used as an off-line technique Was computationally far too demanding Rendering times of minutes and hours Recently Interactive ray tracing on supercomputers [Parker, U. Utah 98] Interactive ray tracing on PCs [Wald 01] Distributed ray tracing on PC clusters [Wald 01] OpenRT-System (www.openrt.de) Demo later today

What is Possible? Models Physics of Global Light Transport Dependable, physically-correct visualization

What is Possible? Huge Models Logarithmic scaling in scene size 12.5 Million Triangles ~1 Billion Triangles

Huge & Realistic 3D Models Outdoor environment: ~365,000 plants, ~1.5 billion triangles Rendered in realtime with skylight illumination on PC cluster

Boeing 777 Boeing 777: ~350 million individual polygons, ~30 GB on disk

Volume Visualization Iso-Surface Volume Rendering

Higher Order Surfaces Splines & Subdivision Surfaces: little memory, constant fps

Measured Materials Data Courtesy R. Klein, Uni Bonn

Realistic Visualization: CAD

Games?

Realtime Lighting Simulation

Lighting Simulation Complex Scattering Highly accurate Results 250k / 3 fps 25M / 11 fps Photograph

Fundamental Ray Tracing Steps Generation of primary rays Rays from viewpoint along viewing directions into 3D scene (At least) one ray per picture element (pixel) Ray tracing Traversal of spatial index structures Intersection of ray with scene geometry Shading From intersection, determine light color sent along primary ray Determines pixel color Needed Local material color and reflection properties Object texture Local illumination of intersection point Can be hard to determine correctly

Ray and Object Representations Ray in space: r(t)=o+t d o=(o x, o y, o z ) d=(d x, d y, d z ) Scene geometry Sphere: (p-c) (p-c)-r 2 =0 c : sphere center r : sphere radius p : any surface point Plane: (p-a) n=0 Implicit definition n : surface normal a : one given surface point p : any surface point Triangles: Plane intersection plus barycentric coordinates

Perspective Camera Model Definition of the pinhole camera o: Origin (point of view) f: Vector to center of view (focal length) u: Up-vector of camera orientation, in one plane with y vector x, y: Span half the viewing window (frustum) relative to coordinate system (o, f, u) xres, yres: Image resolution for (x= 0; x < xres; x++) for (y= 0; y < yres; y++) { d= f + 2(x/xres - 0.5) x + 2(y/yres - 0.5) y; d= d/ d ; // Normalize col= trace(o, d); write_pixel(x,y,col); } u d o f y x

Intersection Ray Sphere Sphere Given a sphere at the origin x 2 + y 2 + z 2-1=0 Given a ray r = o + td (r x = o x + td x and so on) o: origin, d: direction Substituting the ray into the equation for the sphere gives t 2 (d x2 + d 2 y + d z2 ) + 2t (d x o x + d y o y + d z o z ) + (o x2 + o 2 y + o z2 ) 1 = 0 Easily solvable with standard techniques But beware of numerical imprecision Alternative: Geometric construction R Ray and center span a plane Simple 2D construction d o

Intersection Ray Plane Plane: Implicit representation (Hesse form) Plane equation: p n - D = 0, n = 1 n: Normal vector: D: Normal distance of plane from (0, 0, 0): Two possible approaches Geometric Mathematic Substitute o + td for p (o + td) n D = 0 Solving for t gives D o n t = d n o o n d d n D p n

Intersection Ray Triangle Barycentric coordinates Non-degenerate triangle ABC Every point P in the plane can be described using P= λ 1 A + λ 2 B + λ 3 C λ 1 + λ 2 + λ 3 = 1 1 Interpretation of barycentric coordinates λ 3 = (APB) / (ACB) etc For fixed λ 3, P may move parallel to AB For λ 1 + λ 2 =1 P= (1-λ 3 ) (λ 1 A + λ 2 B) + λ 3 C (0 < λ 3 < 1) 0 P moves between C and AB A C P λ 3 B Point is in triangle, iff all λ i greater or equal than zero

Intersection Ray Triangle (2) Compute intersection with triangle plane Given the 3D intersection point Project point into xy, xz, yz coordinate plane Use coordinate plane that is most aligned xy: if n z is maximal, etc. Coordinate plane and 2D vertices can be pre-computed Compute barycentric n coordinates Test for positive BCs

Precision Problems Inaccuracies of the intersection points computations due to floatingpoint arithmetic can result in incorrect shadow rays (self-shadowing) or infinite loops for secondary rays which have origins at a previously found intersection point. A simple solution is to check if the value of parameter t (used for intersection point calculations) is within some tolerance. For example, if abs(t) < 0.00001, then that t describes the origin of some ray as being on the object. The tolerance should be scaled to the size of the environment.

Intersection Ray- Box Ray/box intersections are important because boxes are used as bounding volumes, especially in hierarchical schemes. To check if a ray intersects a box, we treat each pair of parallel planes in turn, calculating the distance along the ray to the first plane t near and the second plane t far. If the value of t near for one pair of planes is greater than t far for another pair of planes, the ray cannot intersect the box.

History of Intersection Algorithms Ray-geometry intersection algorithms Polygons: [Appel 68] Quadrics, CSG: [Goldstein & Nagel 71] Recursive Ray Tracing: [Whitted 79] Tori: [Roth 82] Bicubic patches: [Whitted 80, Kajiya 82] Algebraic surfaces: [Hanrahan 82] Swept surfaces: [Kajiya 83, van Wijk 84] Fractals: [Kajiya 83] Deformations: [Barr 86] NURBS: [Stürzlinger 98] Subdivision surfaces: [Kobbelt et al 98]

Shading Intersection point determines primary ray s color Diffuse object: color at intersection point No variation with viewing angle: diffuse (Lambertian) Must still be illuminated Point light source: shadow ray Scales linearly with received light (Irradiance) No illumination: in shadow = black Non-Lambertian Reflectance Appearance depends on illumination and viewing direction Local Bi-directional Reflectance Distribution Function (BRDF) Simple cases Mirror, glass: secondary rays Area light sources, indirect illumination can be difficult

Recursive Ray Tracing reflected ray shadow rays refracted ray Searching recursively for paths to light sources Interaction of light & material at intersection points Recursively trace new rays in reflection, refraction, and light direction primary ray pixel image plane viewpoint

Ray Tracing Algorithm Trace(ray) Search the next intersection point (hit, material) Return Shade(ray, hit, material) Shade(ray, hit, material) For each light source if ShadowTrace(ray to light source, distance to light) Calculate reflected radiance (i.e. Phong) Adding to the reflected radiance If mirroring material Calculate radiance in reflected direction: Trace(R(ray, hit)) Adding mirroring part to the reflected radiance Same for transmission Return reflected radiance ShadowTrace(ray, dist) Return false, if intersection point with distance < dist has been found

Ray Tracing Incorporates into a single framework Hidden surface removal Front to back traversal Early termination once first hit point is found Shadow computation Shadow rays/ shadow feelers are traced between a point on a surface and a light sources Exact simulation of some light paths Reflection (reflected rays at a mirror surface) Refraction (refracted rays at a transparent surface, Snell s law) Limitations Easily gets inefficient for full global illumination computations Many reflections (exponential increase in number of rays) Indirect illumination requires many rays to sample all incoming directions

Ray Tracing: Approximations Usually RGB color model instead of full spectrum Finite number of point lights instead of full indirect light Approximate material reflectance properties Ambient: constant, non-directional background light Diffuse: light reflected uniformly in all directions, Specular: perfect reflection, refraction All are based on purely empirical foundation

Wrap-Up Background Forward light transport vs. backward search in RT Ray tracer Ray generation, ray-object intersection, shading Ray-geometry intersection calculation Sphere, plane, triangle, box Recursive ray tracing algorithm Primary, secondary, shadow rays Next lecture Advanced acceleration techniques