College of Computer and Information Science, Northeastern UniversityFebruary 3, 20161 CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.

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.
Lecture 8 Transparency, Mirroring
Waves – Topic 4 Chapters 26 Reflection & Refraction Reflection & Refraction Reflection & Refraction.
Refraction at plane surface and Prisms Dr. M K Raghavendra BASE, Bangalore.
Computer Graphics Lecture 4 Geometry & Transformations.
Lecture 14 Illumination II – Global Models
1 Computer Graphics Chapter 8 3D Transformations.
Light Issues in Computer Graphics Presented by Saleema Amershi.
Illumination Model & Surface-rendering Method 박 경 와.
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.
Copyright © 2009 Pearson Education, Inc. Chapter 32 Light: Reflection and Refraction.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
©College of Computer and Information Science, Northeastern UniversityJune 26, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 11.
CS 376 Introduction to Computer Graphics 03 / 30 / 2007 Instructor: Michael Eckmann.
CS 376 Introduction to Computer Graphics 04 / 04 / 2007 Instructor: Michael Eckmann.
Basic Ray Tracing CMSC 435/634. Visibility Problem Rendering: converting a model to an image Visibility: deciding which objects (or parts) will appear.
Reflection and Refraction Physics Mrs. Coyle. Reflection When a wave reaches a boundary it is: –Partially reflected (bounces off surface) –Partially transmitted.
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.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Ray Tracing Primer Ref: SIGGRAPH HyperGraphHyperGraph.
©College of Computer and Information Science, Northeastern UniversitySeptember 9, CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture.
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.
CS 376 Introduction to Computer Graphics 04 / 11 / 2007 Instructor: Michael Eckmann.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
College of Computer and Information Science, Northeastern UniversityOctober 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.
CS-378: Game Technology Lecture #2.1: Projection Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
College of Computer and Information Science, Northeastern UniversityOctober 18, CS5310 Graduate Computer Graphics Prof. Harriet Fell Spring 2011.
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.
CS 325 Introduction to Computer Graphics 03 / 26 / 2010 Instructor: Michael Eckmann.
Light, Reflection, and Refraction Chapters 14 and 15.
Programming 3D Applications CE Displaying Computer Graphics Week 3 Lecture 5 Bob Hobbs Faculty of Computing, Engineering and Technology Staffordshire.
CS559: Computer Graphics Lecture 9: Rasterization Li Zhang Spring 2008.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
CS 450: COMPUTER GRAPHICS TRANSPARENT SURFACES SPRING 2015 DR. MICHAEL J. REALE.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
1 Chapter 2: Geometric Camera Models Objective: Formulate the geometrical relationships between image and scene measurements Scene: a 3-D function, g(x,y,z)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS 376 Introduction to Computer Graphics 04 / 02 / 2007 Instructor: Michael Eckmann.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
1 By Mike Maloney © 2003 Mike Maloney2 Light as a Ray Light very often travels in straight lines. We represent light using rays, which are straight lines.
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.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
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.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
CS552: Computer Graphics Lecture 33: Illumination and Shading.
Graphics Review Geometry, Color & Shading Brad Tennis Leslie Wu
Review Ray Tracing III Review. Pseudo codes RayCast-1  Plain ray caster (direct illumination) RayCast-2  RayCast-1 + shadow rays RayTrace-1  Recursive.
Basic Ray Tracing CMSC 435/634.
CS G140 Graduate Computer Graphics
CS G140 Graduate Computer Graphics
3D Graphics Rendering PPT By Ricardo Veguilla.
Computer Graphics Transformations
Ray Tracing.
14th Lecture – Final Lecture
GR2 Advanced Computer Graphics AGR
CS G140 Graduate Computer Graphics
Presentation transcript:

College of Computer and Information Science, Northeastern UniversityFebruary 3, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006 Lecture 3 - January 30, 2006

College of Computer and Information Science, Northeastern UniversityFebruary 3, Today’s Topics Homogeneous Coordinates Viewing in 2D 3D Transformations Viewing – from Shirley et al. Chapter 7 Recursive Ray Tracing  Reflection  Refraction

College of Computer and Information Science, Northeastern UniversityFebruary 3, Translation y x y x (a, b) This is not a linear transformation. The origin moves. (x, y)  (x+a,y+b)

College of Computer and Information Science, Northeastern UniversityFebruary 3, Homogeneous Coordinates x x y z y Embed the xy-plane in R 3 at z = 1. (x, y)  (x, y, 1)

College of Computer and Information Science, Northeastern UniversityFebruary 3, D Linear Transformations as 3D Matrices Any 2D linear transformation can be represented by a 2x2 matrix or a 3x3 matrix

College of Computer and Information Science, Northeastern UniversityFebruary 3, D Linear Translations as 3D Matrices Any 2D translation can be represented by a 3x3 matrix. This is a 3D shear that acts as a translation on the plane z = 1.

College of Computer and Information Science, Northeastern UniversityFebruary 3, Translation as a Shear x x y z y

College of Computer and Information Science, Northeastern UniversityFebruary 3, D Affine Transformations An affine transformation is any transformation that preserves co-linearity (i.e., all points lying on a line initially still lie on a line after transformation) and ratios of distances (e.g., the midpoint of a line segment remains the midpoint after transformation). With homogeneous coordinates, we can represent all 2D affine transformations as 3D linear transformations. We can then use matrix multiplication to transform objects.

College of Computer and Information Science, Northeastern UniversityFebruary 3, y x Rotation about an Arbitrary Point y x  

College of Computer and Information Science, Northeastern UniversityFebruary 3,  y x Rotation about an Arbitrary Point   T(-c x, -c y ) R(  ) T(c x, c y )

College of Computer and Information Science, Northeastern UniversityFebruary 3, Windowing Transforms (a,b) (A,B) (c,d) (C,D) (C-c,D-d) (A-a,B-b) translate scale translate

College of Computer and Information Science, Northeastern UniversityFebruary 3, D Transformations Remember: A 3D linear transformation can be represented by a 3x3 matrix.

College of Computer and Information Science, Northeastern UniversityFebruary 3, D Affine Transformations

College of Computer and Information Science, Northeastern UniversityFebruary 3, D Rotations

College of Computer and Information Science, Northeastern UniversityFebruary 3, Canonical View Volume (-1,-1,-1) (1,1,1) x y z

College of Computer and Information Science, Northeastern UniversityFebruary 3, (3,2) (0,0) (0,3) Pixel Coordinates y x x = -0.5 y = 4.5 y = x = 4.5

College of Computer and Information Science, Northeastern UniversityFebruary 3, y x (-1,1) (1,-1) reflect Canonical View to Pixels y x (-1,-1) (1,1) x (-n x /2,n y /2) y (n x /2,-n y /2) scale y x (-0.5, n y --0.5) (n x -0.5, -0.5) translate

College of Computer and Information Science, Northeastern UniversityFebruary 3, Orthographic Projection ( l,b,n ) ( r,t,f ) x y z left bottom near right top far

College of Computer and Information Science, Northeastern UniversityFebruary 3, Orthographic Projection Math

College of Computer and Information Science, Northeastern UniversityFebruary 3, Orthographic Projection Math

College of Computer and Information Science, Northeastern UniversityFebruary 3, Arbitrary View Positions g aze t he view-up e ye w = -g ||g|| u = t x w ||t x w|| v = w x u

College of Computer and Information Science, Northeastern UniversityFebruary 3, Arbitrary Position Geometry e v u w (u=r,v=t,w=f) (u=l,v=b,w=n) o z y x

College of Computer and Information Science, Northeastern UniversityFebruary 3, Arbitrary Position Transformation Move e to the origin and align (u, v, w) with (x, y, z). Compute M = M o M v. For each line segment (a,b) p = Ma, q = Mb, drawline(p,q).

College of Computer and Information Science, Northeastern UniversityFebruary 3, Perspective Projection ( l,b,n ) ( r,t,f ) x y z

College of Computer and Information Science, Northeastern UniversityFebruary 3, Lines to Lines

College of Computer and Information Science, Northeastern UniversityFebruary 3, Perspective Geometry g View plane y ysys n z y s = (n/z)y e

College of Computer and Information Science, Northeastern UniversityFebruary 3, Perspective Transformation The perspective transformation should take Where p(n) = n p(f) = f and n  z 1 > z 2  f implies p(z 1 ) > p(z 2 ). P(z) = n + f – fn/z satisfies these requirements.

College of Computer and Information Science, Northeastern UniversityFebruary 3, Perspective Transformation is not a linear transformation. is a linear transformation.

College of Computer and Information Science, Northeastern UniversityFebruary 3, The Whole Truth about Homogeneous Coordinates A point in 2-space corresponds to a line through the origin in 3-space minus the origin itself. A point in 3-space corresponds to a line through the origin in 4-space minus the origin itself.

College of Computer and Information Science, Northeastern UniversityFebruary 3, Homogenize

College of Computer and Information Science, Northeastern UniversityFebruary 3, Perspective Transformation Matrix Compute M = M o M p M v. For each line segment (a,b) p = Ma, q = Mb, drawline(homogenize(p), homogenize ( q)).

College of Computer and Information Science, Northeastern UniversityFebruary 3, Viewing for Ray-Tracing Simplest Views (0, 0, 0) (wd, ht, 0) screen (wd/s, ht/2, d)

A Viewing System for Ray-Tracing g aze e ye near distance = |g| (e x, e y, e z ) = w h perp (w/2, h/2, n) (0, 0, 0) (w, h, 0) |p|j -nk-nk You need a transformation that sends (e x, e y, e z ) to (w/2, h/2, n) g to –nk p to |p|j

College of Computer and Information Science, Northeastern UniversityFebruary 3, Time for a Break

College of Computer and Information Science, Northeastern UniversityFebruary 3, Recursive Ray Tracing Adventures of the 7 Rays - Watt Specular Highlight on Outside of Shere

College of Computer and Information Science, Northeastern UniversityFebruary 3, Adventures of the 7 Rays - Watt Specular Highlight on Inside of Sphere Recursive Ray Tracing

College of Computer and Information Science, Northeastern UniversityFebruary 3, Adventures of the 7 Rays - Watt Reflection and Refraction of Checkerboard Recursive Ray Tracing

College of Computer and Information Science, Northeastern UniversityFebruary 3, Adventures of the 7 Rays - Watt Refraction Hitting Background Recursive Ray Tracing

College of Computer and Information Science, Northeastern UniversityFebruary 3, Adventures of the 7 Rays - Watt Local Diffuse Plus Reflection from Checkerboard Recursive Ray Tracing

College of Computer and Information Science, Northeastern UniversityFebruary 3, Adventures of the 7 Rays - Watt Local Diffuse in Complete Shadow Recursive Ray Tracing

College of Computer and Information Science, Northeastern UniversityFebruary 3, Adventures of the 7 Rays - Watt Local Diffuse in Shadow from Transparent Sphere Recursive Ray Tracing

College of Computer and Information Science, Northeastern UniversityFebruary 3, Recursive Ray-Tracing How do we know which rays to follow? How do we compute those rays? How do we organize code so we can follow all those different rays?

select center of projection(cp) and window on view plane; for (each scan line in the image ) { for (each pixel in scan line ) { determine ray from the cp through the pixel; pixel = RT_trace(ray, 1);}} // intersect ray with objects; compute shade at closest intersection // depth is current depth in ray tree RT_color RT_trace (RT_ray ray; int depth){ determine closest intersection of ray with an object; if (object hit) { compute normal at intersection; return RT_shade (closest object hit, ray, intersection, normal, depth);} else return BACKGROUND_VALUE; }

// Compute shade at point on object, // tracing rays for shadows, reflection, refraction. RT_color RT_shade ( RT_object object,// Object intersected RT_ray ray,// Incident ray RT_point point,// Point of intersection to shade RT_normal normal,// Normal at point int depth )// Depth in ray tree { RT_color color; // Color of ray RT_ray rRay, tRay, sRay;// Reflected, refracted, and shadow ray color = ambient term ; for ( each light ) { sRay = ray from point to light ; if ( dot product of normal and direction to light is positive ){ compute how much light is blocked by opaque and transparent surfaces, and use to scale diffuse and specular terms before adding them to color;}}

if ( depth < maxDepth ) {// return if depth is too deep if ( object is reflective ) { rRay = ray in reflection direction from point; rColor = RT_trace(rRay, depth + 1); scale rColor by specular coefficient and add to color; } if ( object is transparent ) { tRay = ray in refraction direction from point; if ( total internal reflection does not occur ) { tColor = RT_trace(tRay, depth + 1); scale tColor by transmission coefficient and add to color; } return color;// Return the color of the ray }

College of Computer and Information Science, Northeastern UniversityFebruary 3, Computing R I N R   I R L+R L + R = (2 L  N) N R = (2 L  N) N - L ININ ININ

College of Computer and Information Science, Northeastern UniversityFebruary 3, Reflections, no Highlight

College of Computer and Information Science, Northeastern UniversityFebruary 3, Second Order Reflection

College of Computer and Information Science, Northeastern UniversityFebruary 3, Refelction with Highlight

College of Computer and Information Science, Northeastern UniversityFebruary 3, Nine Red Balls

College of Computer and Information Science, Northeastern UniversityFebruary 3, Refraction N -N I T TT II

College of Computer and Information Science, Northeastern UniversityFebruary 3, Refraction and Wavelength N -N I T TT II

College of Computer and Information Science, Northeastern UniversityFebruary 3, Computing T N -N I M T TT II sin(  I ) cos(  I ) I = - sin(  I )M + cos(  I )N T = sin(  T )M - cos(  T )N How do we compute M, sin(  T ), and cos(  T )? We look at this in more detail

College of Computer and Information Science, Northeastern UniversityFebruary 3, Computing T -N T TT II x sin(  T ) cos(  T )

Computing T -N T TT II = x sin(  T ) cos(  T ) II I Parallel to I

College of Computer and Information Science, Northeastern UniversityFebruary 3, Total Internal Reflection When is cos(  T ) defined? Then there is no transmitting ray and we have total internal reflection.

College of Computer and Information Science, Northeastern UniversityFebruary 3, Index of Refraction The speed of all electromagnetic radiation in vacuum is the same, approximately 3×108 meters per second, and is denoted by c. Therefore, if v is the phase velocity of radiation of a specific frequency in a specific material, the refractive index is given byphase velocity

College of Computer and Information Science, Northeastern UniversityFebruary 3, Indices of Refraction Material  at λ=589.3 nm vacuum1 (exactly) helium air at STP water ice1.31 liquid water (20°C)1.333 ethanol1.36 glycerine rock salt1.516 glass (typical)1.5 to 1.9 cubic zirconia2.15 to 2.18 diamond

College of Computer and Information Science, Northeastern UniversityFebruary 3, One Glass Sphere

College of Computer and Information Science, Northeastern UniversityFebruary 3, Five Glass Balls

College of Computer and Information Science, Northeastern UniversityFebruary 3, A Familiar Scene

College of Computer and Information Science, Northeastern UniversityFebruary 3, Bubble

College of Computer and Information Science, Northeastern UniversityFebruary 3, Milky Sphere

College of Computer and Information Science, Northeastern UniversityFebruary 3, Lens - Carl Andrews 1999