Ray Tracing.

Slides:



Advertisements
Similar presentations
GR2 Advanced Computer Graphics AGR
Advertisements

13.1 si31_2001 SI31 Advanced Computer Graphics AGR Lecture 13 An Introduction to Ray Tracing.
May Visible Surface Detection Shmuel Wimer Bar Ilan Univ., Eng. Faculty Technion, EE Faculty.
Light Issues in Computer Graphics Presented by Saleema Amershi.
Illumination Model & Surface-rendering Method 박 경 와.
Ray Tracing Tutorial. Ray Casting One type of visibility algorithm.
CS 325 Introduction to Computer Graphics 04 / 09 / 2010 Instructor: Michael Eckmann.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
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.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
Ray Tracing Outline For each pixel { Shoot ray r from eye to center of pixel with trace( r ) } function trace( r ) For each object { Find object with closest.
Ray Tracing Jerry Sui Adam Conner. Part I – Introduction to Ray Tracing Final Product.
1 7M836 Animation & Rendering Global illumination, ray tracing Arjan Kok
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
CSCE 641: Computer Graphics Ray Tracing Jinxiang Chai.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
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.
CS 376 Introduction to Computer Graphics 04 / 11 / 2007 Instructor: Michael Eckmann.
Ray Tracing Chapter CAP4730: Computational Structures in Computer Graphics.
College of Computer and Information Science, Northeastern UniversityOctober 18, CS5310 Graduate Computer Graphics Prof. Harriet Fell Spring 2011.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
1 Ray-Tracing ©Anthony Steed Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!
1 Dr. Scott Schaefer Intersecting Simple Surfaces.
Basic Ray Tracing CMSC 435/634.
CS380: Computer Graphics Distributed Ray Tracing TA Course URL:
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
Project 3 Help Session: Ray Tracing. Getting Started Download the starter pack. 1.sample_ray.exe 2.ray-skel directory 3.scenes directory Look at the Road.
College of Computer and Information Science, Northeastern UniversityFebruary 3, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
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.
Ray Tracing I. Reading Hill, Chapter 14, Sections 14.1 to 14.5 Hill, Chapter 14, Sections and
Illumination and Shading Prof. Lizhuang Ma Shanghai Jiao Tong University.
Basic Ray Tracing CMSC 435/634.
Photorealistic Rendering vs. Interactive 3D Graphics
Introduction to Computer Graphics with WebGL
Ray Tracing Ed Angel Professor Emeritus of Computer Science
CS G140 Graduate Computer Graphics
Ray Tracing Forward Ray Tracing
Intersecting Simple Surfaces
Prof. Harriet Fell Spring 2007 Lecture 26 – March 19, 2007
3D Graphics Rendering PPT By Ricardo Veguilla.
RAY TRACING.
Prof. Harriet Fell Fall 2011 Lecture 24 – November 2, 2011
Introduction to Computer Graphics with WebGL
Lighting.
SHADING MODELS FOR POLYGONS
Reflection and Refraction
Isaac Gang University of Mary Hardin-Baylor
Image.
An Algorithm of Eye-Based Ray Tracing on MATLAB
CS5500 Computer Graphics May 29, 2006
Illumination and Shading
CSCE 441: Computer Graphics Ray Tracing
GR2 Advanced Computer Graphics AGR
CS G140 Graduate Computer Graphics
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Illumination Model 고려대학교 컴퓨터 그래픽스 연구실.
Reflection and Refraction
Simple Texture Mapping
Reflection and Refraction
Introduction to Ray Tracing
Presentation transcript:

Ray Tracing

Ray Tracing Highly realistic Considerable computation time

Ray Tracing prp

Ray Tracing R3 T3 T2 R2 R4 R1 T1 T4 R1 T1 R2 T2 R4 T4 prp R3 T3

Ray Tracing Algorithm main() { Select prp for (each scan line) for (each pixel in scan line) determine ray from prp through pixel pixel = Trace (ray, 1) } Trace (ray, depth) determine closest intersection of ray with an object if (object hit) compute normal at intersection return Shade( closest object hit, ray, intersection, normal, depth) else return background_value Shade ( object, ray, point, normal, depth) { color = ambient term for (each light) Sray = ray to light from point if (N.L>0) compute how much light is blocked by opaque and transparent surfaces, use it to scale diffuse and specular terms and add term to color if (depth < maxdepth) if (object is reflective) Rray = ray in reflection direction from point Rcolor = Trace (Rray, depth+1) scale Rcolor by specular coeff. and add to color if (object is transparent) Tray = ray in refraction direction from point if (total internal reflection does not occur) Tcolor = Trace (Tray, depth+1) scale Tcolor by transmission coeff. and add to color return color }

Ray Tracing ambient light: ka Ia diffuse light: kd (N.L) specular light: ks (H.N)ns specular reflection direction: R = u-(2u.N)N T = [(hi/hr) cos qi - cos qr] N - (hi/hr)L cos qr = √1 - (hi/hr)2 (1-cos2 qi ) reflected light R L shadow ray T qr N qi hr H hi u incoming ray (viewing direction V = -u)

Ray Tracing Ray equation u = ------------------ | Ppix – Pprp | P = P0 + s.u P: any point along the ray P0: initial position vector s: distance of P to P0 u: unit direction vector Ppix – Pprp u = ------------------ | Ppix – Pprp | Initially P0 is Ppix or prp. Update P0 and u at each intersection point on the ray with a surface. y ray path u P0 Ppix x prp z

Ray Tracing P: intersection point of the sphere along the ray Pc: center of sphere r: radius of sphere |P - Pc |2 – r2 = 0 |P0 + s.u - Pc |2 – r2 = 0 s = u.P  (u.P)2 - |P|2+r2 where P = Pc – P0 If discriminant < 0 ray does not intersect sphere Otherwise calculate P using P = P0 + s.u P r P0 x y z u Pc

Ray Tracing If the ray does not intersect the sphere, eliminate the polyhedra Otherwise do the following: Identify front faces using: u.N<0 For each face that satisfies u.N<0: - Solve plane equation: N.P = -D N.(P0 + s.u) = -D  s = - (D+N.P) N.u - Perform inside-outside test to check if the intersection is inside the polygon P0 x y z u Pc u Infinite plane

Ray Tracing

Ray Tracing

Ray Tracing

Ray Tracing