CS559: Computer Graphics Lecture 28: Ray Tracing Li Zhang Spring 2010 Slides are from Ravi Ramamoorthi’s graphics class at Columbia U.

Slides:



Advertisements
Similar presentations
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Advertisements

03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Real-Time Rendering SPEACIAL EFFECTS Lecture 03 Marina Gavrilova.
Christian Lauterbach COMP 770, 2/11/2009
HCI 530 : Seminar (HCI) Damian Schofield.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Alla Sheffer Advanced Rendering Week.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 15: Ray Tracing/Global Illumination Ravi Ramamoorthi Slides.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
Computer Graphics (Fall 2005) COMS 4160, Lecture 21: Ray Tracing
Chapter 4 Digital Multimedia, 2nd edition Vector Graphics.
(conventional Cartesian reference system)
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
1/12/09 1 Introduction Computer Graphics COMP 770 (236) Spring 2009 Instructor: Dinesh Manocha.
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
7M836 Animation & Rendering
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 14: Ray Tracing
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CS248 Final Review Derek Chan and Abe Davis. CS248 Final Monday, December 8, 3:30 to 6:30 pm Closed book, closed notes Mainly from material in the second.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Lecture 8 Advanced Rendering – Ray Tracing, Radiosity & NPR.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 2: Basic Ray Tracing Ravi Ramamoorthi Some slides courtesy.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
COMP 175: Computer Graphics March 24, 2015
Computer Graphics Panos Trahanias ΗΥ358 Spring 2009.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
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.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
Ray Tracing Jian Huang, CS 594, Fall, 2002 This set of slides are used at Ohio State by Prof. Roger Crawfis.
Foundations of Computer Graphics (Spring 2012) CS 184, Lectures 16, 18: Nuts and bolts of Ray Tracing Acknowledgements:
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Vector Graphics Digital Multimedia Chap 이병희
CS559: Computer Graphics Lecture 36: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
COMP135/COMP535 Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 4 Lecture 4 - Vector Graphics.
Subject Name: Computer Graphics Subject Code: Textbook: “Computer Graphics”, C Version By Hearn and Baker Credits: 6 1.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
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.
CS 445 / 645 Introduction to Computer Graphics Lecture 24 Final Exam Prep Lecture 24 Final Exam Prep.
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.
CS559: Computer Graphics Final Review Li Zhang Spring 2010.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
CS 445 / 645: Introductory Computer Graphics Review.
RENDERING : Global Illumination
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.
CS559: Computer Graphics Lecture 36: Raytracing Li Zhang Spring 2008 Many Slides are from Hua Zhong at CUM, Paul Debevec at USC.
Computer Graphics One of the central components of three-dimensional graphics has been a basic system that renders objects represented by a set of polygons.
CS559: Computer Graphics Lecture 27: Animation, Depth & Motion Blur, Ray Tracing Li Zhang Spring 2010 Slides from Brian Curless at U of Washington.
CS559: Computer Graphics Lecture 27: Animation, Depth & Motion Blur, Ray Tracing Li Zhang Spring 2010 Slides from Brian Curless at U of Washington.
Applications and Rendering pipeline
Basic Ray Tracing CMSC 435/634.
Advanced Computer Graphics
Rendering Pipeline Fall, 2015.
CSE 167 [Win 17], Lecture 15: Ray Tracing Ravi Ramamoorthi
Computer Graphics.
3D Graphics Rendering PPT By Ricardo Veguilla.
© University of Wisconsin, CS559 Fall 2004
Presentation transcript:

CS559: Computer Graphics Lecture 28: Ray Tracing Li Zhang Spring 2010 Slides are from Ravi Ramamoorthi’s graphics class at Columbia U

Effects needed for Realism  Reflections (Mirrors and Glossy)  Transparency (Water, Glass)  Interreflections (Color Bleeding)  (Soft) Shadows  Complex Illumination (Natural, Area Light)  Realistic Materials (Velvet, Paints, Glass)  And many more Image courtesy Paul Heckbert 1983

Ray Tracing  Different Approach to Image Synthesis as compared to Hardware pipeline (OpenGL)  OpenGL : Object by Object  Ray Tracing : Pixel by Pixel  Advantage:  Easy to compute shadows/transparency/etc  Disadvantage:  Slow (in early days)

Basic Version: Ray Casting Virtual Viewpoint Virtual ScreenObjects Ray misses all objects: Pixel colored blackRay intersects object: shade using color, lights, materialsMultiple intersections: Use closest one (as does OpenGL)

Shadows Virtual Viewpoint Virtual ScreenObjects 10.5 in textbook Light Source Shadow ray to light is unblocked: object visibleShadow ray to light is blocked: object in shadow

Mirror Reflections/Refractions Virtual Viewpoint Virtual ScreenObjects Generate reflected ray in mirror direction, Get reflections and refractions of objects

Recursive Ray Tracing (Core Idea) For each pixel  Trace Primary Eye Ray, find intersection  Trace Secondary Shadow Ray(s) to all light(s)  Color = Visible1 ? Illumination Model(light1) : 0 ;  Color += Visible2 ? Illumination Model(light2) : 0 ; ……  Trace Reflected Ray  Color += reflectivity * Color of reflected ray  Trace Refracted Ray  Color += transparency * Color of refracted ray Recursive function Calls

Example  Sphere  How to decide there is an intersection?  Triangle  How to decide the intersection is inside?  Polygon  How to decide the intersection is inside?  How about an ellipsoid?

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

Acceleration Testing each object for each ray is slow  Faster Intersections  Optimized Ray-Object Intersections  Fewer Intersections

Acceleration Structures Bounding boxes (possibly hierarchical) If no intersection bounding box, needn’t check objects Bounding Box Ray Different Spatial Hierarchies (Oct-trees, kd trees, BSP trees)

Octree

K-d tree

Acceleration Structures: Grids

Anti-aliasing  Aliasing when drawing a diagonal on a square grid:  stairstepping  AKA jaggies  Especially noticeable:  high-contrast edges  near horizontal or near vertical  As line rotates (in 2D)  steps change length  corners of steps slide along the edge  known as crawlies

Supersampling  A more popular method (although less elegant) is supersampling:  Point sample the pixel at several locations  Combine the results into the final pixel color  By sampling more times per pixel:  Raises the sampling rate  Raises the frequencies we can capture  Commonly use 16 or more samples per pixel  Requires potentially 16 times as much work to generate image  16 times Memory?  A brute-force approach  But straightforward to implement  Very powerful

Moiré Artifact

Random Sampling  Supersample at several randomly located points  Breaks up repeating signals  Eliminates Moir é patterns  Instead of aliasing, frequencies greater than 1 pixel appear as noise in the image  Noise tends to be less objectionable to the viewer than jaggies or Moir é patterns  The human eye is pretty good at filtering out noise  But suffers from potential clustering and gaps  Result is not necessarily accurate  Too much noise.

Jittered Sampling  AKA stratified sampling,  Divide pixel into a grid of subpixels  Sample each subpixel at a random location  Combines the advantages of both uniform and random sampling  filters high frequencies  frequencies greater than subpixel sampling rate turned into noise  Commonly used

Soft shadow penumbra

Soft Shadow

Comparison

Glossy Surface

Vertical vs Horizonal roughness

Ray tracing a glossy surface

Ray tracing a glossy surface

Depth of Field

aperture sensor Focal plane

Depth of Field aperture sensor Focal plane

Depth of Field in OpenGL

 Render an image at each jittered location  Then average the images

Motion Blur  Ray trace a moving scene at different time instance and average the images

Motion Blur in OpenGL  Render a moving scene at different time instance  Average the images (using Accumulation buffer)

Ray tracing examples

Image Based Rendering  Motivation  Realistic Rendering requires  realistic 3D models  realistic material models  takes time

Rendering a desktop

Rendering in real-time, with global illumination effect (e.g. inter-reflection)

Image Based Rendering  Fast Realistic Rendering without 3D models

Start from Ray Tracing  Rendering is about computing color along each ray

Sampling Rays

Sampling Rays by Taking Pictures

Rendering as Ray Resampling

Ray space  How to parameterize the ray space  How to sample and resample rays

Two Plane Parameterization

Stanford Camera Array

Light Field Rendering  Very Fast

Light Field Rendering  4D interpolation

Light Field Rendering  Don’t need to model anything:  surface model,  volumetric model,  lighting model,  surface property model…  NOTHING but sampling and resampling rays.

Application in Movies

Capture scene with a camera array

Bullet time in Games Max PayneMax Payne (2001)

Discussion  Limitation  Sampling density must be high  Fixed Illumination, static scene

Methods using Fewer Cameras  High-quality video view interpolation using a layered representation. C. L. Zitnick, S.B. Kang, M. Uyttendaele, S. Winder, and R. Szeliski, SIGGRAPH 2004 High-quality video view interpolation using a layered representation. polation.htm

CS559: Computer Graphics Final Review Li Zhang Spring 2010

What’s not in the final OpenGL and FLTK syntax Image based Rendering

Eyes and Cameras Camera obscura – Pinhole, lens – Different ways of capturing color Optical effect – Motion blur – Depth of Field

Images Minimum Sample requirement – Sampling theorem Re-sampling – Up-sampling, down-sampling – Anti-aliasing Compositing – Alpha channel

Image Filtering Convolution – Continuous and discrete Linear filter – Blur, shift, sharpen, edge detection… Painter algorithm, Project 1 – Iteratively apply strokes

Image warping 2D transformation – Scale, Rotate, affine, translate, … – Inverse transformation Properties of 2D transformations – Line to line, parallel to parallel, … Homogeneous transformation Forward warping – Splatting Inverse warping – Reconstruction

Image morphing What do we need? – Avoid ghosting How to do it? – Warping + blending

3D transform Homogenous Coordinate – Point vs direction – Transforming normals 3D rotation – property – Different representation – Geometric interpretation Concatenation of transforms – Hierarchical modeling

Projection Graphics pipeline Orthographic vs perspective projection – Matrix representation – Vanishing point View frustum – Clipping plane, Field of view – Convert to projection matrix Canonical view volume – From perspective view volume

Scan conversion and visibility Draw lines and triangles – Tricks to make it fast – Anti-aliasing BSP – How to construct and how to use Z buffer vs A buffer – Pros and cons

Shading Phong shading model – Emission, diffuse, specular Types of light sources – Point, spot, directional Shading interpolation – Flat, Gouraud, and Phong

Curves Implicit vs Parametric Curves Polynomial Curves – How to evaluate polynomial – How to compute the curve – Problem with high order polynomials Piecewise cubic polynomial – Continuity: C0,C1,C2 – Local control – interpolation

Curves Natural, Hermite, Catmull-Rom, Cardinal, Bezier, – Commonality and differences Bezier curves – Subdivision – De Casteljau – Generalization –…–…

Texture Calculate texture coord – Perspective correct interpolation Texture resampling – Antialiasing: Mipmap, Ripmap, SAT How do they work, What can they do, limitation Other usages: – Bump Map, Displacement Map, 3D Texture, Environment Map, Shadow map – Projector texture (no requirement)

Shape Boundary vs Solid modeling Parametric, Implicit, Procedural – Pros and cons Polygon meshes – Why popular – Pros and cons – Data structure

Shape Sweep objects Spatial enumeration – Oct tree Bezier Patch – Bilinear, biquadric, bicubic – De Casteljau

Subdivision Curves and Surfaces Approximating vs Interpolating Regular vs Irregular vertices Continuity Loop, sqrt(3), Catmull-Clark – Commanality and difference – Piecewise smoothness (no requirement) Fractal Modeling – Terrains, trees, …

Animation Particle Systems – Euler method – Collision Detection and Response Principles of Cartoon

Raytracing Recursive procedure – Shadow, Transparency, Reflection, Refraction – Why inter-reflection is hard? – Anti-aliasing: jittered sampling, why – Soft shadow, glossy surface, – Depth of field, Motion blur Ray object intersection – Simple objects: triangle, polygons, … Spatial data structure for Acceleration – BSP, octtree, grid