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

Similar documents
Ray Tracing. Outline. Ray Tracing: History

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

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

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

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

Ray Casting. Outline. Similar to glulookat derivation. Foundations of Computer Graphics

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

Sung-Eui Yoon ( 윤성의 )

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

Lecture 11: Ray tracing (cont.)

CS559: Computer Graphics

CPSC GLOBAL ILLUMINATION

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

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

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

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

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

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

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

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

Intro to Ray-Tracing & Ray-Surface Acceleration

Illumination Algorithms

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

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

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

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

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

Ray Tracing Foley & Van Dam, Chapters 15 and 16

Computer Graphics. Bing-Yu Chen National Taiwan University

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

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

COMP371 COMPUTER GRAPHICS

Computer Graphics Ray Casting. Matthias Teschner

Lecture 11. More Ray Casting/Tracing

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

03 RENDERING PART TWO

Assignment 6: Ray Tracing

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

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Supplement to Lecture 16

Geometric Queries for Ray Tracing

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

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

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

Ray Casting. 3D Rendering. Ray Casting. Ray Casting. Ray Casting. Ray Casting

Accelerating Ray Tracing

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

Review for Ray-tracing Algorithm and Hardware

Chapter 7 - Light, Materials, Appearance

Computer Graphics and Image Processing Ray Tracing I

The Traditional Graphics Pipeline

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Spatial Data Structures

Questions??? Announcements Assignment 3 due today

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

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

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

Shading, Advanced Rendering. Week 7, Wed Feb 28

Accelerated Raytracing

Spatial Data Structures

Lecture 10: Ray tracing

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

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

Ray Tracing. Last Time? Reading for Today. Reading for Today

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Ray Tracing. Computer Graphics CMU /15-662, Fall 2016

1999, Denis Zorin. Ray tracing

Acceleration Data Structures

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

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

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Computer Graphics I Lecture 11

The Traditional Graphics Pipeline

Viewing and Ray Tracing. CS 4620 Lecture 4

Photorealism: Ray Tracing

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Ray Casting. COS 426, Spring 2015 Princeton University

Accelerating Ray-Tracing

Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Programming projects. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer. Assignment 1: Basic ray tracer

Viewing and Ray Tracing

Ray Tracing I. Internet Raytracing Competition

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

Last week. Machiraju/Zhang/Möller

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Ray tracing. EECS 487 March 19,

Spatial Data Structures

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

Computer Graphics. Lecture 9 Environment mapping, Mirroring

8.1 Geometric Queries for Ray Tracing

Ray Tracing CSCI 4239/5239 Advanced Computer Graphics Spring 2018

Introduction to Visualization and Computer Graphics

Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Photorealism. Photorealism: Ray Tracing. Ray Tracing

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

Texture Mapping and Special Effects

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

CS-184: Computer Graphics. Administrative

Transcription:

Foundations of omputer Graphics (Spring 202) S 84, Lecture 5: Ray Tracing http://inst.eecs.berkeley.edu/~cs84 Effects needed for Realism (Soft) Shadows Reflections (Mirrors and Glossy) Transparency (Water, Glass) Interreflections (olor Bleeding) omplex Illumination (Natural, Area Light) Realistic Materials (Velvet, Paints, Glass) And many more Ray Tracing Different Approach to Image Synthesis as compared to Hardware pipeline (OpenGL) Pixel by Pixel instead of Object by Object Easy to compute shadows/transparency/etc Image courtesy Paul Heckbert 983 Ray Tracing: History Appel 68 Whitted 80 [recursive ray tracing] Landmark in computer graphics Lots of work on various geometric primitives Lots of work on accelerations Real-Time raytracing (historically, slow technique) Ray tracing architecture hapter 4 in text

Ray Tracing History Ray Tracing History in ode Image Raytrace (amera cam, Scene scene, int width, int height) { Image image = new Image (width, height) ; for (int i = 0 ; i < height ; i++) for (int j = 0 ; j < width ; j++) { Ray ray = RayThruPixel (cam, i, j) ; Intersection hit = Intersect (ray, scene) ; image[i][j] = Findolor (hit) ; } return image ; } // orresponds to ray generation, intersection, shading in 4. Ray asting Ray asting Produce same images as with OpenGL Visibility per pixel instead of Z-buffer Find nearest object by shooting rays into scene Shade it as in standard OpenGL Virtual Viewpoint Virtual Screen Objects Ray Multiple intersects misses intersections: all object: objects: shade Pixel Use using colored closest color, black one lights, (as does materials OpenGL) 2

omparison to hardware scan-line Per-pixel evaluation, per-pixel rays (not scan-convert each object). On face of it, costly But good for walkthroughs of extremely large models (amortize preprocessing, low complexity) More complex shading, lighting effects possible hapters 4.7, 4.8 Shadows Light Source Shadows: Numerical Issues Numerical inaccuracy may cause intersection to be below surface (effect exaggerated in figure) ausing surface to incorrectly shadow itself Move a little towards light before shooting shadow ray Virtual Viewpoint Virtual Screen Objects Shadow ray to to light is is unblocked: object visible in shadow Mirror Reflections/Refractions Recursive Ray Tracing For each pixel Trace Primary Eye Ray, find intersection Trace Secondary Shadow Ray(s) to all light(s) olor = Visible? Illumination Model : 0 ; Virtual Viewpoint Trace Reflected Ray olor += reflectivity * olor of reflected ray Virtual Screen Generate reflected ray in mirror direction, Get reflections and refractions of objects Objects 3

Problems with Recursion Reflection rays may be traced forever Generally, set maximum recursion depth Same for transmitted rays (take refraction into account) Turner Whitted 980 Effects needed for Realism (Soft) Shadows Reflections (Mirrors and Glossy) Transparency (Water, Glass) Interreflections (olor Bleeding) omplex Illumination (Natural, Area Light) Realistic Materials (Velvet, Paints, Glass) Discussed in this lecture Not discussed but possible with distribution ray tracing (3) Hard (but not impossible) with ray tracing; radiosity methods Ray/Object Intersections Heart of Ray Tracer One of the main initial research areas Optimized routines for wide variety of primitives Various types of info Shadow rays: Intersection/No Intersection Primary rays: Point of intersection, material, normals Texture coordinates Work out examples Triangle, sphere, polygon, general implicit surface Ray-Sphere Intersection ray P P0 Pt sphere P P r P 0 2 ( ) ( ) 0 4

Ray-Sphere Intersection ray P P0 Pt 2 sphere ( P ) ( P ) r Substitute ray P P0 Pt 2 sphere ( P0 Pt ) ( P0 Pt ) r Simplify 2 2 t ( P P) 2 t P ( P ) ( P ) ( P ) r 0 0 0 Ray-Sphere Intersection 2 2 t ( P P) 2 t P ( P ) ( P ) ( P ) r 0 0 0 Solve quadratic equations for t 2 real positive roots: pick smaller root Both roots same: tangent to sphere One positive, one negative root: ray origin inside sphere (pick + root) omplex roots: no intersection (check discriminant of equation first) Ray-Sphere Intersection ray P P Pt Intersection point: 0 Normal (for sphere, this is same as coordinates in sphere frame of reference, useful other tasks) P normal P Ray-Triangle Intersection One approach: Ray-Plane intersection, then check if inside triangle B A n Plane equation: plane P n A n ( A) ( B A) ( A) ( B A) Ray-Triangle Intersection One approach: Ray-Plane intersection, then check if inside triangle B A n Plane equation: plane P n A n ombine with ray equation: ray P P0 Pt A n P0 n t ( P Pt) n A n P n 0 ( A) ( B A) ( A) ( B A) Ray inside Triangle Once intersect with plane, still need to find if in triangle Many possibilities for triangles, general polygons (point in polygon tests) We find parametrically [barycentric coordinates]. Also useful for other applications (texture mapping) A α β P γ B P A B,, 5

Ray inside Triangle Other primitives A B P A B α β P,, γ P A ( B A) ( A) 0, 0 Much early work in ray tracing focused on ray-primitive intersection tests ones, cylinders, ellipsoids Boxes (especially useful for bounding boxes) General planar polygons Many more Many references. For example, chapter in Glassner introduction to ray tracing (see me if interested) Ray-Tracing Transformed Objects We have an optimized ray-sphere test But we want to ray trace an ellipsoid Solution: Ellipsoid transforms sphere Apply inverse transform to ray, use ray-sphere Allows for instancing (traffic jam of cars) Mathematical details worked out in class 3.2 in text Transformed Objects onsider a general 4x4 transform M Will need to implement matrix stacks like in OpenGL Apply inverse transform M - to ray Locations stored and transform in homogeneous coordinates Vectors (ray directions) have homogeneous coordinate set to 0 [so there is no action because of translations] Do standard ray-surface intersection as modified Transform intersection back to actual coordinates Intersection point p transforms as Mp Distance to intersection if used may need recalculation Normals n transform as M -t n. Do all this before lighting Acceleration Testing each object for each ray is slow Fewer Rays Adaptive sampling, depth control Generalized Rays Beam tracing, cone tracing, pencil tracing etc. Faster Intersections Optimized Ray-Object Intersections Fewer Intersections We just discuss some approaches at high level; chapter 3 briefly covers 6

Acceleration Structures Acceleration Structures: Grids Bounding boxes (possibly hierarchical) If no intersection bounding box, needn t check objects Bounding Box Ray Spatial Hierarchies (Oct-trees, kd trees, BSP trees) Acceleration and Regular Grids Simplest acceleration, for example 5x5x5 grid For each grid cell, store overlapping triangles March ray along grid (need to be careful with this), test against each triangle in grid cell More sophisticated: kd-tree, oct-tree bsp-tree Or use (hierarchical) bounding boxes Try to implement some acceleration in HW 5 Interactive Raytracing Ray tracing historically slow Now viable alternative for complex scenes Key is sublinear complexity with acceleration; need not process all triangles in scene Allows many effects hard in hardware OpenRT project real-time ray tracing (http://www.openrt.de) NVIDIA OptiX ray-tracing API like OpenGL 7

Raytracing on Graphics Hardware Modern Programmable Hardware general streaming architecture an map various elements of ray tracing Kernels like eye rays, intersect etc. In vertex or fragment programs onvergence between hardware, ray tracing [Purcell et al. 2002, 2003] http://graphics.stanford.edu/papers/photongfx 8