Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Lecture 14 Illumination II – Global Models
Advanced Effects CMSC 435/634. General Approach Ray Tracing – Shoot more rays Rasterization – Render more images.
Shadow Rendering Techniques A point is in the shadow of a light source if it can not be “seen” by the light source, i.e. the line segment that connects.
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
Advanced Ray Tracing CMSC 435/634. Basic Ray Tracing For each pixel – Compute ray direction – Find closest surface – For each light Compute direct illumination.
Light Issues in Computer Graphics Presented by Saleema Amershi.
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
Computer Graphics - Class 10
IMGD 1001: Illumination by Mark Claypool
CS 376 Introduction to Computer Graphics 04 / 09 / 2007 Instructor: Michael Eckmann.
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.
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
7M836 Animation & Rendering
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Lighting and Shading Week.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CIS 310: Visual Programming, Spring 2006 Western State College 310: Visual Programming Ray Tracing.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
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.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
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
Chapter 18: Ray Optics Lisa & Becky. Ray Model of Light  Light rays travel in straight lines  Light rays cross but do not interact  Light rays travel.
Reflections Specular reflection is the perfect reflection of light from a surface. The law a reflection states that the direction of the incoming ray and.
Project Raytracing. Content Goals Idea of Raytracing Ray Casting – Therory – Practice Raytracing – Theory – Light model – Practice Output images Conclusion.
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.
CSC418 Computer Graphics n Illumination n Lights n Lightinging models.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Ray Tracing.
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.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Basic Rendering Pipeline and Shading Spring 2012.
Recursion and Data Structures in Computer Graphics Ray Tracing 1.
CSE 681 DISTRIBUTED RAY TRACING some implementation notes.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Basic Ray Tracing CMSC 435/634.
Ray-tracing.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
CSCE 441: Computer Graphics Ray Tracing
Local Illumination and Shading
CS 445 / 645 Introduction to Computer Graphics Lecture 16 Lighting Lighting.
1. Ray Casting Surface intersection Visible surface detection Ray Tracing Bounce the ray Collecting intensity Technique for global reflection and transmission.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
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.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
CSL 859: Advanced Computer Graphics Dept of Computer Sc. & Engg. IIT Delhi.
Optics Mirrors and Lenses. Topics for Optics Reflection of LightReflection of Light –Law of Reflection –Plane Mirrors –Concave Mirrors –Convex Mirrors.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
CS552: Computer Graphics Lecture 36: Ray Tracing.
Introduction to Ray Tracing Dr. B. Raghu Professor /CSE Sri Ramanujar Engineering College.
Basic Ray Tracing CMSC 435/634.
3D Rendering 2016, Fall.
© University of Wisconsin, CS559 Fall 2004
Lighting.
UMBC Graphics for Games
Image.
GR2 Advanced Computer Graphics AGR
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

Basic Ray Tracing CMSC 435/634

Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear in the image – Object-order OpenGL (later) – Image-order Ray Tracing (now)

Raytracing Given – Scene – Viewpoint – Viewplane Cast ray from viewpoint through pixels into scene

View

Computing Viewing Rays Parametric ray Camera frame : eye point : basis vectors – right, up, backward Right hand rule! Screen position

Calculating Intersections Define ray parametrically: If is center of projection and is center of pixel, then : points between those locations : points behind viewer : points beyond view window

Ray-Sphere Intersection Sphere in vector form Ray Intersection when

Ray-Polygon Intersection Given ray and plane containing polygon What is ray/plane intersection? Is intersection point inside polygon?

Ray-Triangle Intersection Intersection of ray with barycentric triangle – In triangle if α ≥ 0,  ≥ 0,  ≥ 0 – To avoid computing all three, can replace α ≥ 0 with  +  ≤ 1 boolean raytri (ray r, vector p0, p1, p2, interval [t 0,t 1 ] ) { compute t if (( t t 1 )) return ( false ) compute  if ((  1)) return ( false ) compute  if ((  1)) return ( false ) return true }

Point in Polygon? Is P in polygon? Cast ray from P to infinity – 1 crossing = inside – 0, 2 crossings = outside

Point in Polygon? Is P in concave polygon? Cast ray from P to infinity – Odd crossings = inside – Even crossings = outside

What Happens?

Raytracing Characteristics Good – Simple to implement – Minimal memory required – Easy to extend Bad – Aliasing – Computationally intensive Intersections expensive (75-90% of rendering time) Lots of rays

Basic Illumination Concepts Terms – Illumination: calculating light intensity at a point (object space; equation) based loosely on physical laws – Shading: algorithm for calculating intensities at pixels (image space; algorithm) Objects – Light sources: light-emitting – Other objects: light-reflecting Light sources – Point (special case: at infinity) – Area

Lambert ’ s Law Intensity of reflected light related to orientation

Lambert ’ s Law Specifically: the radiant energy from any small surface area dA in any direction  relative to the surface normal is proportional to cos 

Ambient Light Additional light bounces we’re not counting Approximate them as a constant = Amount of extra light coming into this surface = Amount that bounces off of this surface Total extra light bouncing off this surface

Combined Model Adding color: For any wavelength :

19 Shadows What if there is an object between the surface and light?

Ray Traced Shadows Trace a ray – Start = point on surface – End = light source – t=0 at Suface, t=1 at Light – “Bias” to avoid surface acne Test – Bias ≤ t ≤ 1 = shadow – t 1 = use this light

Mirror Reflection The Dark Side of the Trees - Gilles Tran, Spheres - Martin K. B. 21

22 Ray Tracing Reflection Viewer looking in direction d sees whatever the viewer “below” the surface sees looking in direction r In the real world – Energy loss on the bounce – Loss different for different colors New ray – Start on surface, in reflection direction

Calculating Reflection Vector Angle of of incidence = angle of reflection Decompose Recompose

Ray Traced Reflection Avoid looping forever – Stop after n bounces – Stop when contribution to pixel gets too small

Specular Reflection Shiny reflection from rough surface Centered around mirror reflection direction – But more spread more, depending on roughness Easiest for individual light sources

Specular vs. Mirror Reflection

H vector Strongest for normal that reflects to – One at center of highlight – Zero at 90° Control highlight width

Combined Specular & Mirror Many surfaces have both

Refraction

Top

Front

Calculating Refraction Vector Snell’s Law In terms of term

Calculating Refraction Vector Snell’s Law In terms of term

Calculating Refraction Vector Snell’s Law In terms of In terms of and

Alpha Blending How much makes it through  = opacity – How much of foreground color  = transparency – How much of background color Foreground*  + Background*(1-  )

Refraction and Alpha Refraction = what direction  = how much – Often approximate as a constant – Better: Use Fresnel – Schlick approximation

Full Ray-Tracing For each pixel – Compute ray direction – Find closest surface – For each light Shoot shadow ray If not shadowed, add direct illumination – Shoot ray in reflection direction – Shoot ray in refraction direction

Motion Blur Things move while the shutter is open

Ray Traced Motion Blur Include information on object motion Spread multiple rays per pixel across time

Depth of Field Soler et al., Fourier Depth of Field, ACM TOG v28n2, April 2009

Pinhole Lens

Lens Model

Real Lens Focal Plane

Lens Model Focal Plane

Ray Traced DOF Move image plane out to focal plane Jitter start position within lens aperture – Smaller aperture = closer to pinhole – Larger aperture = more DOF blur