CptS 548 (Advanced Computer Graphics) Unit 2: Basic Ray Tracing

Size: px
Start display at page:

Download "CptS 548 (Advanced Computer Graphics) Unit 2: Basic Ray Tracing"

Transcription

1 CptS 548 (Advanced Computer Graphics) Unit 2: Basic Ray Tracing Bob Lewis School of Engineering and Applied Science Washington State University Spring, 2018

2 Why Build a Ray Tracer? Ray tracing is more elegant than polygon scan conversion. Testbed for lots of effects in modelling rendering texturing animation Ray tracers are the easiest renderers to implement. Ray tracers are used in practically all other photorealistic renderers. "Ray tracing is the future of computer graphics, and always will be."

3 Rays r(t) = õ + dt parameter origin d o This is a parametric equation. The parameter t is >= 0. The ray direction d is always unit length in the coordinate system, so t is a distance. When transforming the ray, we must not only transform õ and d, but renormalize d.

4 Unit 2: Basic Ray Tracing Part Part Part Part Part 1: 2: 3: 4: 5: Intersections and Targets Top-Down Ray Tracing Viewing Rays Representing Luminaires and Materials Alternatives to Ray Tracing Why We Call it Ray Tracing (or Casting) scene Mathematically trace rays from the eye through a viewing plane (pixel) into a scene. Compute intersection(s) with objects in the scene. Compute lighting at the closest intersection. If this is a simple lighting calculation, we call it ray casting. If it s more complicated (e.g. tracing additional rays), we call it ray tracing. Set pixel to computed color (or background if no object is hit). Bob Lewis WSU CptS 548 (Spring, 2018)

5 Ray/Implicit Surface Intersections Implicit surfaces are given by f (x, y, z) = f ( p) = 0. Substitute p r(t) = õ + dt into it, you get f ( r(t)) = 0. How many equations are there? How many unknowns? What kind of mathematical problem is this? Are these easy to solve, in general? After we compute the intersection, we need the surface normal N Why? (Hint: Why did we need them in coaster?)

6 Aside: Partial Derivatives Partial derivatives are symbolic operations on functions. We compute the partial derivative f x of a function f (x, y, z) with respect to one of its variables (x, here) by taking that variable s derivative while treating all other variables as constant. Example: ( 3x 2 + 2xz + 4y 5 ) = (6x + 2z) x You can approximate them with very small increments h: f (x + h, y, z) f (x h, y, z) f (x, y, z) x 2h This is, of course, properly frowned on by mathematicians.

7 Aside: The Gradient Operator A very important operator on implicit functions is the gradient: f (x, y, z) = f f x + x y ŷ + f z ẑ Note that this is a vector. Example: ( 3x 2 + 2xz + 4y 5 ) = (6x + 2z) x + (4) ŷ + (2x) ẑ Q: What is the gradient of a sphere centered on the origin?

8 Ray/Implicit Surface Intersections: Planes For a plane f ( p) = ( N p) + D, If you know one point p 0 on the plane, D = ( N p 0 ). Substitute p = r(t) = õ + dt into it, you get Solve to get What can go wrong? ( N õ) + ( N d)t + D = 0. t = D + ( N õ) ( N d) Why are we taking a dot product of a vector with a point?

9 Ray/Parametric Surface Intersections: General Recall a parametric surface definition: f (u, v) p(u, v) = g(u, v) h(u, v) So we need to solve this for t, u, and v: r(t) = p(u, v) õ + dt = f (u, v) g(u, v) h(u, v) A solution is possible, given three equations in three unknowns, but it is not easy. Nevertheless, if we do find a solution, computing the normal is easy...

10 Parametric Surface Normals We can compute a parametric surface normal easily: N(u, v) = p u p v p u p v As with implicit surfaces, the partial derivatives can be computed numerically, to similar consternation of mathematicians. We re assuming that p u and p v are never parallel.

11 Ray/Sphere Intersections (Problem) Like planes, spheres are implicit surfaces: f ( p) = p c 2 R 2 = 0 Substitute p r(t) = õ + dt and you get õ + dt c 2 R 2 = 0 Rearranging and recalling that d 1, you get t 2 + 2( d (õ c))t + õ c 2 R 2 = 0 What kind of equation is this? Is it easy to solve? Sure!...

12 Ray/Sphere Intersections (Solution) solution: where t = B ± B 2 4AC 2A A = 1 B = 2( d (õ c)) C = õ c 2 R 2 How many solutions are possible and what do the possible values of the discriminant (B 2 4AC) say about them?

13 Aside: Spheres Can Be Bounding Boxes The sphere intersection test is pretty cheap: We can often use them for bounding box testing. Given a (very) complicated object with an expensive intersection test, Make a sphere big enough to contain the whole object. Test the ray intersection with the sphere. If the ray misses the sphere, it will miss everything contained in the sphere, so you can skip the expensive test. If the ray hits the sphere, do the expensive test. (The sphere test becomes overhead.) Other bounding box tests (e.g. actual boxes ) are also possible.

14 Ray/Triangle Intersections (Problem) Imagine a triangle defined by points ã, b, and c. c b a In 3D, this defines a plane, right? Any point p in this plane can be expressed by... p = ã + β( b ã) + γ( c ã) This is a variation on barycentric coordinates.

15 Aside: Barycentric Coordinates Definition: It s easy to show that: For any point in the plane: p(α, β, γ) = αã + β b + γ c α + β + γ = 1 If and only if α, β, and γ all lie between 0 and 1, p is within the triangle. We use the above equation to get rid of α in the equation on the previous slide.

16 Ray/Triangle Intersections (Problem, continued) We have p = ã + β( b ã) + γ( c ã) From barycentric considerations, we can show 0 γ 1 and 0 β 1 γ iff p is in the triangle, so substitute p r(t) = õ + dt and then solve: õ + dt = ã + β( b ã) + γ( c ã) How many equations? How many unknowns? What are they? Is this a linear equation? If so, how can we express it as such?

17 Ray/Triangle Intersections (Solution) Rewriting õ + dt = ã + β( b ã) + γ( c ã) in matrix form, we get: [ ] β β ( b ã) ( c ã) d γ M γ = [ (õ ã) ] t t so β γ t = M 1 [ (õ ã) ] How do we interpret results? What if M cannot be inverted? What ranges of β, γ, and t are important? How do we solve for β, γ, and t? Do we always need to solve for all three unknowns?

18 Generalizing Ray/Object Intersections This is an embarassingly simple example of object orientation. Create an abstract superclass Target. Add virtual methods firstintersectionbetween() and getnormal(). Add modelling transforms to it. Create subclasses for each kind of object (Plane, Sphere, Triangle, etc.). Add leaf methods to each subclass as needed. Your raytracer works on a collection of Targets. All geometry-specific knowledge is in subclasses.

19 The Initial Target Hierarchy Here s the idea in UML: UML methods usually have inout and out arguments to indicate multiple returns. In our pseudocode below, we ll always follow the output(s) = method(input(s)) convention.

20 Target Example: The Halfspace Class class Halfspace :... Tuple firstintersectionbetween ( halfspace, ray, tmin, tmax ): targetray = ray. transform ( halfspace. scenetotargettransform ) eqnat0 = targetray. origin [2] # z - component ddotn = -targetray. normalizeddirection [2] if abs ( ddotn ) < EPSILON : # ray is nearly perpendicular to the plane if abs ( eqnat0 ) >= EPSILON : return (tmin, tmax, None ) # ray origin doesn t lie in the plane targett = 0 # arbitrary, could be any non - negative value else : targett = eqnat0 / ddotn targetp = targetray. position ( targett ) p = targetp. transform ( halfspace. targettoscenetransform ) t = (p - ray. origin ). mag () # ray direction is normalized if t < tmin or t > tmax : return (tmin, tmax, None ) # intersection is too far away tmax = t # closer than previous tmax return (tmin, tmax, Intersection ( halfspace, p)) Vector3D getnormal ( halfspace, p): # returns the 3rd column target -to - scene transform ( normalized ) return Vector3D ( halfspace. targettoscenetransform [0:2,2]). normalized ()

21 Notes on the Halfspace Class This pseudocode only looks like Python: It isn t. We use the target prefix to identify entities that are defined in the target frame. Halfspaces are always x-y planes with z normals. (They can be transformed to any other position and orientation.) Only t values between tmin and tmax (inclusive) count. Think of getnormal() as transforming (0, 0, 1) in the target frame into scene coordinates.

22 Camera.renderImage(): A High-Level Ray Tracer This is really all there is to a raytracer: class Camera :... Image renderimage ( camera, scene, width, height ): image = Image ( width, height ) for iu from 0 to width -1: for iv from 0 to height -1: column = iu row = height iv image [ row, column ] = camera. renderpixel ( scene, width, height, iu, iv) return image Radiance renderpixel ( camera, scene, width, height, iu, iv ): ray = camera.viewingray(width, height, iu + 0.5, iv + 0.5) return scene.traceray(ray, 0)

23 Notes on Camera.renderImage() Think of it this way: renderimage() turns a Scene and a Camera into an Image. Convention: Red indicates methods we have yet to cover. The ray goes through the middle (0.5, 0.5) of the pixel. We could combine the two statements in renderpixel() into a single one, but we don t, for reasons that will be clear later. Multiple cameras looking at the same scene could be used for stereo and/or multiple users. A set of images from multiple cameras and scenes changing over time could be frames for an animation.

24 Scene.traceRay() class Scene :... Radiance traceray ( scene, ray, tmin ): intersection = scene. firstintersection (ray, tmin ) if intersection!= None : return intersection.target.material.illuminate(intersection, ray, scene) else : return scene. backgroundradiance Intersection firstintersection ( scene, ray, tmin ): # Why pass tmin? Isn t it always 0? (No, see later.) tmax = intersection = None for target in scene. targets : (tmin, tmax, newintersection ) = target. firstintersectionbetween ( ray, tmin, tmax ) if newintersection is not None : intersection = newintersection return intersection

25 Lighting: Direct vs. Indirect C B A Direct light bounces off a (non-mirror) surface once before it reaches the eye (e.g. bulb-a-eye). Indirect light bounces off more than one surface before it reaches the eye. (e.g. bulb-b-c-eye) The room you re in is probably lit mostly by indirect light. Direct light is easy to do with ray tracing. Indirect light is hard except for a few special cases so we use some hacks and wait to improve things later.

26 Lighting: Lambert s Law Lambert s Law defines a diffuse surface as one for which reflected light obeys the formula L r = ER cos θ i, where Lr is the reflected radiance (power per unit area per unit solid angle) E is the incident normal irradiance (power per unit area) intrinsic to the light source (hereafter, luminaire ) R is the (diffuse) reflectance intrinsic to the surface θ i is the incident angle (between the normal and the luminaire direction) Note that there is no dependency on the reflected angle θ r. This is true at every wavelength or channel. Many surfaces in nature (and man-made) are diffuse, or almost so.

27 Implementing Diffuse Surfaces ^n ^v θ r θ i ^s ~ p For an intersection point p, we have the eye vector v (= d) the surface normal n (from the target) a vector ŝ in the direction towards the luminaire (computed from the luminaire properties) So how do we replace the cosine in Lambert s Law?

28 Shader.directRadiance() The Material abstract class represents Target illumination properties. The Shader (also abstract) subclass is for Materials with a bidirectional reflectance distribution function (BRDF). class Shader :... Radiance directradiance ( shader, intersection, incidentray, luminaire ): towardscamera = - incidentray. normalizeddirection # v normal = intersection. getnormal () # n towardsluminaire = luminaire.towards(intersection.p) # ŝ return (shader.brdf(towardsluminaire, normal, towardscamera) * luminaire.irradiance(intersection.p, normal)) Shader.brdf() is a (virtual) method which computes the bi-directional reflectance distribution function (hereafter BRDF ).

29 DiffuseShader.brdf() The simplest Shader subclass is DiffuseShader. This represents classic Lambertian surfaces. class DiffuseShader :... Rgb brdf ( diffuseshader, towardsluminaire, normal, towardscamera ): return diffuseshader. reflectivity

30 Shadows ^n ^v θ r θ i ^s ~ p What if there s an object between the luminaire and p? Is there some tool we could use to find out if the path from p to the luminaire is blocked?

31 Material.illuminate() class Material :... Radiance illuminate ( material, intersection, incidentray, scene ): radiance = material.indirectradiance(intersection, incidentray,scene) towardscamera = -incidentray. normalizeddirection # = v p = intersection.p # = p normal = intersection. target. getnormal (p) # = n for luminaire in scene. luminaires : towardsluminaire = luminaire.towards(p) # = ŝ if dot ( normal, towardsluminaire ) > 0: # above horizon shadowray = Ray (p, towardsluminaire ) shadowintersection = scene. firstintersection ( shadowray, EPSILON ) if shadowintersection == None or luminaire.isbetween(shadowintersection.p, p): radiance += material. directradiance ( towardscamera, normal, luminaire ) return radiance What purpose does EPSILON serve in the scene.firstintersection() call?

32 Part Part Part Part Part Unit 2: Basic Ray Tracing 1: 2: 3: 4: 5: Intersections and Targets Top-Down Ray Tracing Viewing Rays Representing Luminaires and Materials Alternatives to Ray Tracing Constructing Viewing Rays: Viewing Geometry y^ ~ e g^ image plane x^ j=0 j=1 z^ d d^ ~ o... -> uvw? u... i=1 j=h 1 i=w 1 i=0 Note the reversal of the image plane and eye point compared to OpenGL. There s a reason for this we ll see in the distribution raytracing unit. Bob Lewis WSU CptS 548 (Spring, 2018)

33 Viewing Geometry II given (in scene coordinates): to find (in scene coordinates): ẽ: the eye prime position == uvw (xyz) coords õ: the ray origin g: the gaze direction u: the up direction w and h: image dimensions i and j: pixel indices Θ y : the y field of view (angle) d: the ray direction

34 Transforming World to Viewing Coordinate Bases Similarly to what we did in CptS 442/542, compute these in order: ẑ = g g x = u ẑ u ẑ ŷ = ẑ x Combined with ẽ, we have the transforms between scene and viewing coordinates. Q: Is this a right-handed or left-handed coordinate system?

35 Constructing the View Ray I We ll compute the ray origin õ, starting with õ y, its y coordinate in view coordinates. Looking sideways in the z y plane: ^y j=0 o ~ y (i, j)= ~ ( h 1 2 ) j e ^z Θ y h d j=h 1 We want to convert pixel coordinate j to õ y lying between h/2 and h/2. We need d, the distance in pixels from ẽ to the image plane. Trigonometry says: ( ) Θy tan 2 = d = h 2 d h ( ) Θy 2 tan 2

36 Constructing the View Ray II The same holds true in the z x plane for (Θ x, w) (Θ y, h) (although we don t actually need Θ x ). So the formula for õ(i, j) in camera coordinates is: õ (i, j) = and since all rays pass through ẽ w 1 2 i h 1 2 j d d (i, j) = ẽ õ (i, j) (note: not normalized yet) but since ẽ is the origin of viewing coordinates and we re working in those coordinates, this is just d (i, j) = õ (i, j)

37 Constructing the View Ray III Having d (i, j) in view coordinates, we need to turn it back into scene coordinates, so we multiply each component of d (i, j) by its corresponding vector. This is actually a matrix transform: [ ] d(i, j) = x ŷ ẑ d (i, j) ( ) ( w 1 h 1 = i x 2 2 ( = i w 1 ) ( x + j h ) j ŷ dẑ ) ŷ dẑ

38 Constructing the View Ray IV So now we normalize d(i, j) to construct the ray: d(i, j) = d(i, j) d(i, j) Rather than transform the õ (i, j) we used above as the ray origin, we could just as easily use the origin of the coordinate system all the rays pass through there as the ray origin (and remember that d is a vector). In scene coordinates, that means õ = ẽ.

39 Perspective You ve now got everything you need to build a raytracer with diffuse objects. I suggest you do this before proceeding, creating a small 2D array of t values (i.e. depths ) instead of an image.

40 Directional Luminaires These are parameterized by direction towards luminaire: l normal irradiance: E. This is the amount of power per unit area perpendicular to the direction of travel. both of which are constant, although you might want to make them methods to be compatible with other luminaires (see below).

41 Point Luminaires These are parameterized by (constant) position: P (constant) power (e.g. in Watts): Φ direction towards luminaire from a point p: ŝ( p) = P p P p normal irradiance at point p: E( p) = Φ 4π p P 2

42 Ambient Luminaires? These are parameterized by ambient radiance: L a which is constant. Each Shader may then have an ambient reflectivity (an Rgb) that multiplies L a. This is an egregious hack!

43 Part Part Part Part Part Unit 2: Basic Ray Tracing 1: 2: 3: 4: 5: Intersections and Targets Top-Down Ray Tracing Viewing Rays Representing Luminaires and Materials Alternatives to Ray Tracing Smooth Metal I n^ θr θi ( =θr ) v^ r^v ~ p Bob Lewis WSU CptS 548 (Spring, 2018)

44 Smooth Metal II If the intersection material is a smooth metal, we want a mirror effect, so we cast a mirror ray starting at p in the reflected direction r v into the scene and incorporate the color we get for that ray into the color we return at p. We allow for less than 100% reflectivity no mirror is perfect and the reflectivity may also be channel-dependent, which allows us to do, say, gold- or copper-colored mirrors, which would have more red, less green, and even less blue reflectances. Here are the details...

45 The Reflection Vector ^n ^v θ r ( =θ i ) θ i r^ v ^v ^n ~ p ^v ^v ^n The reflection vector is given by: r v = v + 2( v n) n But we can also use the ray direction d( v) instead of v: r v = d 2( d n) n

46 Reflector.indirectRadiance() Mirror reflectors are a new subclass of Material: class Reflector :... Radiance indirectradiance ( material, intersection, incidentray, scene ): towardscamera = -incidentray. direction. normalized () normal = intersection. getnormal () reflectedray = Ray ( intersection.p, towardscamera. reflect ( normal ), incidentray. refractiveindex, incidentray. depth +1) return material. reflectivity * scene. traceray ( reflectedray, EPSILON ) Note the EPSILON again. Same reason.

47 Aside: What Ray.depth is For Suppose we have two perfect mirrors placed like this:... The depth parameter is one way to limit the number of reflections. There are more accurate possibilities, but this is the easiest. Note, however, that this is one of the shortcomings of raytracing: It can t do complicated mirror geometries.

48 Part Part Part Part Part Unit 2: Basic Ray Tracing 1: 2: 3: 4: 5: Intersections and Targets Top-Down Ray Tracing Viewing Rays Representing Luminaires and Materials Alternatives to Ray Tracing Dielectrics I n^ θt v^ ~ p θi Bob Lewis ^t WSU CptS 548 (Spring, 2018)

49 Dielectrics II If the surface at intersection p is dielectric ((semi-)transparent and light-refracting, like glass or water), we want to show refraction, so we cast a ray starting at p in the transmitted refracted direction t and incorporate the color we get for that ray into the color at p. This may be combined with reflection.

50 Refraction Geometry ^v^v θ i ~ p ^n θ t ^t index n i ^b index n t We always want θ i 90. To enforce this, keep in mind that normals are double-valued: n and n are both perpendicular to the surface. So negate n if ( v n) is initially negative. (This is for refraction: It doesn t matter for reflection.)

51 Snell s Law I Ibn Sahl (Baghdad, c AD) described it first, but Snell (Willebrord Snellius, Dutch, ) gets the credit: n t sin θ t = n i sin θ i Where n i and n t are the indices of refraction of the two media. (These are usually greater than 1. See below.) We rewrite this as: sin θ t = n i sin θ t η 1 ( v n) n 2 t

52 Snell s Law II We know n, but if we also had the tangent (unit) vector b, we could write: t = sin θ t b cos θt n t = ( ) η 1 ( v n) 2 b 1 ( η ) 2 1 ( v n) 2 n (Ugh!)

53 Computing the Tangent Vector b I So let s find b: ^v θ i ^n ( ^v ^n) v t ~ p ^b v has both normal (parallel to n) and tangential (perpendicular to n) components. The normal component is its projection in the n direction, so v = v t + ( v n) n

54 Computing the Tangent Vector b II ^v θ i ^n ( ^v ^n) v t ~ p ^b We extract the tangential component: v t = v ( v n) n b is this vector, negated and normalized: b = v t v t = ( v n) n v 1 ( v n) 2 ( = cos θ i n v sin θ i )

55 The Transmitted Ray Direction Substituting b = ( v n) n v 1 ( v n) 2 into t = ( ) η 1 ( v n) 2 b 1 ( ) 2 η 1 ( v n) 2 n We get (whew!) t = η (( v n) n v) 1 ( ) 2 η 1 ( v n) 2 n What could go wrong? (Watch those square roots!)

56 Indices of Refraction Medium Index of Refraction Methylene Iodide 1.74 Glass, dense flint 1.66 Carbon bisulfide 1.63 Sodium chloride 1.53 Glass, crown 1.52 Fused Quartz 1.46 Ethyl alcohol 1.36 Water 1.33 Air (1 atm, 20 C) Vacuum 1 (by definition)

57 The Fresnel Term When light reflects off a dielectric, its reflectivity has an angular dependence: ( ) R( v, ŝ, η) = 1 (g c) 2 (c(g + c) 1)2 2 (g + c) (c(g c) 1) 2 where c ( v ĥ) ĥ v+ŝ v+ŝ g η 2 + c 2 1 but this is time-consuming. (Aside: we ve seen before.) ĥ is the halfway vector

58 Schlick s Approximation to the Fresnel Term A reasonable approximation to the Fresnel term (due to Christophe Schlick) is where R( v, n, η) = R 0 + (1 R 0 ) (1 ( v n)) 5 R 0 ( η 1 ) 2 1 η Note that this uses the normal n, not ŝ as in the exact Fresnel term.

59 Dielectric.indirectRadiance() class Dielectric :... method indirectradiance ( dielectric, intersection, incidentray, scene ): towardscamera = -incidentray. normalizeddirection # = v normal = intersection. getnormal () # = n if towardscamera.dot ( normal ) < 0.0: normal = - normal # for refraction to work ( no effect on reflection ) reflectedray = Ray ( intersection.p, towardscamera. reflect ( normal ), incidentray. refractiveindex, incidentray. depth +1) transmitteddirection = towardscamera. refract (normal, dielectric. refractiveindex ) # = t refractedray = Ray ( intersection.p, transmitteddirection, dielectric. refractiveindex, incidentray. depth +1) f = dielectric. fresnel ( towardscamera, normal, incidentray. refractiveindex ) radiance = scene. traceray ( reflectedray, EPSILON ) if f < 1.0: # Compute refraction iff reflection isn t total internal. radiance = f * radiance + (1 -f) * scene. traceray ( refractedray, EPSILON ) return dielectric. kabs * radiance

60 Notes on Dielectric.indirectRadiance() To distinguish entries from exits, assume that normals point outwards. To avoid confusion in entry/exit, assume all objects are distinct.

61 Attenuating Media L+dL L x L L 0 Beer s Law: Light passing through an absorbing medium (e.g. smoke) is diminished by fractional amount proportional to the thickness of the medium. dl = CLdx dl dx = CL L = L 0 e Cx e Cx is the attenuation factor. This is the same idea as fog in OpenGL. How would you incorporate this into the schema?

62 Materials: Polished Surfaces This is an alternative shader developed by Shirley: ( L = R 1 (1 ( v n)) 2) ( 1 (1 (ŝ n)) 2) E

63 Materials: A Conventional Ray Tracing Shader Here s our old friend, the EADS shader from 442/542 (and a little OpenGL): L = L e + k a L a + ) (k a + k d (ŝ i n) + k s (ŝ i ĥ)ns E i where all luminaires i L e : emissivity k a : ambient reflectivity L a : ambient irradiance (of scene) ŝ i : direction towards luminaire i k d : diffuse reflectivity. k s : specular reflectivity. n s : specular exponent ( shininess ). E i : luminaire i s normal irradiance Negative dot products are ignored.

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

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College Computer Graphics Ray Tracing Based on slides by Dianna Xu, Bryn Mawr College Ray Tracing Example Created by Anto Matkovic Ray Tracing Example Ray Tracing Example Ray Tracing Most light rays do not reach

More information

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

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing Lecture 11 Ray tracing Introduction Projection vs. ray tracing Projection Ray tracing Rendering Projection vs. ray tracing Projection Ray tracing Basic methods for image generation Major areas of computer

More information

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

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. 11 11.1 Basics So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources. Global models include incident light that arrives

More information

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007 Programming For this assignment you will write a simple ray tracer. It will be written in C++ without

More information

The Rendering Equation. Computer Graphics CMU /15-662

The Rendering Equation. Computer Graphics CMU /15-662 The Rendering Equation Computer Graphics CMU 15-462/15-662 Review: What is radiance? Radiance at point p in direction N is radiant energy ( #hits ) per unit time, per solid angle, per unit area perpendicular

More information

Raytracing. COSC 4328/5327 Scott A. King

Raytracing. COSC 4328/5327 Scott A. King Raytracing COSC 4328/5327 Scott A. King Basic Ray Casting Method pixels in screen Shoot ray p from the eye through the pixel. Find closest ray-object intersection. Get color at intersection Basic Ray Casting

More information

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

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting Ray Casting COMP 175: Computer Graphics April 26, 2018 1/41 Admin } Assignment 4 posted } Picking new partners today for rest of the assignments } Demo in the works } Mac demo may require a new dylib I

More information

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading CENG 477 Introduction to Computer Graphics Ray Tracing: Shading Last Week Until now we learned: How to create the primary rays from the given camera and image plane parameters How to intersect these rays

More information

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects Basic Ray Tracing Rendering: Reality Eye acts as pinhole camera Photons from light hit objects Rendering: Reality Eye acts as pinhole camera Photons from light hit objects Rendering: Reality Eye acts as

More information

CS 5625 Lec 2: Shading Models

CS 5625 Lec 2: Shading Models CS 5625 Lec 2: Shading Models Kavita Bala Spring 2013 Shading Models Chapter 7 Next few weeks Textures Graphics Pipeline Light Emission To compute images What are the light sources? Light Propagation Fog/Clear?

More information

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Local Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller Local Illumination CMPT 361 Introduction to Computer Graphics Torsten Möller Graphics Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism

More information

Computer Graphics. Illumination and Shading

Computer Graphics. Illumination and Shading () Illumination and Shading Dr. Ayman Eldeib Lighting So given a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If we re attempting to create a realistic

More information

Phys 102 Lecture 17 Introduction to ray optics

Phys 102 Lecture 17 Introduction to ray optics Phys 102 Lecture 17 Introduction to ray optics 1 Physics 102 lectures on light Light as a wave Lecture 15 EM waves Lecture 16 Polarization Lecture 22 & 23 Interference & diffraction Light as a ray Lecture

More information

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

Ray Tracing. Last Time? Reading for Today. Reading for Today Last Time? Ray Tracing Keyframing Procedural Animation Physically-Based Animation Forward and Inverse Kinematics Motion Capture Two solutions Reading for Today Artist-Directed Dynamics for 2D Animation,

More information

Ray Tracing. Brian Curless CSEP 557 Fall 2016

Ray Tracing. Brian Curless CSEP 557 Fall 2016 Ray Tracing Brian Curless CSEP 557 Fall 2016 1 Reading Required: Shirley, section 10.1-10.7 (online handout) Triangle intersection (online handout) Further reading: Shirley errata on syllabus page, needed

More information

Lighting and Shading

Lighting and Shading Lighting and Shading Today: Local Illumination Solving the rendering equation is too expensive First do local illumination Then hack in reflections and shadows Local Shading: Notation light intensity in,

More information

Raytracing CS148 AS3. Due :59pm PDT

Raytracing CS148 AS3. Due :59pm PDT Raytracing CS148 AS3 Due 2010-07-25 11:59pm PDT We start our exploration of Rendering - the process of converting a high-level object-based description of scene into an image. We will do this by building

More information

Supplement to Lecture 16

Supplement to Lecture 16 Supplement to Lecture 16 Global Illumination: View Dependent CS 354 Computer Graphics http://www.cs.utexas.edu/~bajaj/ Notes and figures from Ed Angel: Interactive Computer Graphics, 6 th Ed., 2012 Addison

More information

Reflection and Shading

Reflection and Shading Reflection and Shading R. J. Renka Department of Computer Science & Engineering University of North Texas 10/19/2015 Light Sources Realistic rendering requires that we model the interaction between light

More information

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer Lecture 11: Recursive Ray Tracer COMP 175: Computer Graphics April 9, 2018 1/40 Note on using Libraries } C++ STL } Does not always have the same performance. } Interface is (mostly) the same, but implementations

More information

Illumination. Courtesy of Adam Finkelstein, Princeton University

Illumination. Courtesy of Adam Finkelstein, Princeton University llumination Courtesy of Adam Finkelstein, Princeton University Ray Casting mage RayCast(Camera camera, Scene scene, int width, int height) { mage image = new mage(width, height); for (int i = 0; i < width;

More information

Ray-Tracing. Misha Kazhdan

Ray-Tracing. Misha Kazhdan Ray-Tracing Misha Kazhdan Ray-Tracing In graphics, we often represent the surface of a 3D shape by a set of triangles. Goal: Ray-Tracing Take a collection of triangles representing a 3D scene and render

More information

A Little Background. Motivation. Motivation

A Little Background. Motivation. Motivation A Little Background Ray casting Process of shooting rays into scene to get pixel colors Nonrecursive, i.e., no interreflections Origin: Arthur Appel, 1968 (earlier work by others for nonrendering) Ray

More information

Recall: Basic Ray Tracer

Recall: Basic Ray Tracer 1 Recall: Ray Tracing Generate an image by backwards tracing the path of light through pixels on an image plane Simulate the interaction of light with objects Recall: Basic Ray Tracer Trace a primary ray

More information

Illumination & Shading: Part 1

Illumination & Shading: Part 1 Illumination & Shading: Part 1 Light Sources Empirical Illumination Shading Local vs Global Illumination Lecture 10 Comp 236 Spring 2005 Computer Graphics Jargon: Illumination Models Illumination - the

More information

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading

Visual cues to 3D geometry. Light Reflection and Advanced Shading. Shading. Recognizing materials. size (perspective) occlusion shading Visual cues to 3D geometry Light Reflection and Advanced Shading size (perspective) occlusion shading CS 4620 Lecture 17 1 2 Shading Recognizing materials Variation in observed color across an object strongly

More information

CptS 548 (Advanced Computer Graphics) Unit 3: Distribution Ray Tracing

CptS 548 (Advanced Computer Graphics) Unit 3: Distribution Ray Tracing CptS 548 (Advanced Computer Graphics) Unit 3: Distribution Ray Tracing Bob Lewis School of Engineering and Applied Science Washington State University Spring, 2018 References Cook, R. L., Porter, T., and

More information

Lecture 10: Ray tracing

Lecture 10: Ray tracing Interactive Computer Graphics Lecture 10: Ray tracing Graphics Lecture 10: Slide 1 Some slides adopted from H. Pfister, Harvard Graphics Lecture 10: Slide 2 Direct and Global Illumination Direct illumination:

More information

CS 325 Computer Graphics

CS 325 Computer Graphics CS 325 Computer Graphics 04 / 02 / 2012 Instructor: Michael Eckmann Today s Topics Questions? Comments? Illumination modelling Ambient, Diffuse, Specular Reflection Surface Rendering / Shading models Flat

More information

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

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Recollection Models Pixels Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows Can be computed in different stages 1 So far we came to Geometry model 3 Surface

More information

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19 Lecture 17: Recursive Ray Tracing Where is the way where light dwelleth? Job 38:19 1. Raster Graphics Typical graphics terminals today are raster displays. A raster display renders a picture scan line

More information

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required:

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required: Reading Required: Watt, sections 1.3-1.4, 12.1-12.5.1 (handout) Triangle intersection handout Further reading: Ray Tracing Watt errata on syllabus page, needed if you work from his book instead of the

More information

Ray Tracing: shading

Ray Tracing: shading Ray Tracing: shading CS 4620 Lecture 6 2018 Steve Marschner 1 Image so far With eye ray generation and scene intersection for 0

More information

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source

Topic 9: Lighting & Reflection models 9/10/2016. Spot the differences. Terminology. Two Components of Illumination. Ambient Light Source Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

More information

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics Announcements Assignment 4 will be out later today Problem Set 3 is due today or tomorrow by 9am in my mail box (4 th floor NSH) How are the machines working out? I have a meeting with Peter Lee and Bob

More information

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting & shading? Sphere

More information

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Why do we need Lighting

More information

CPSC 314 LIGHTING AND SHADING

CPSC 314 LIGHTING AND SHADING CPSC 314 LIGHTING AND SHADING UGRAD.CS.UBC.CA/~CS314 slide credits: Mikhail Bessmeltsev et al 1 THE RENDERING PIPELINE Vertices and attributes Vertex Shader Modelview transform Per-vertex attributes Vertex

More information

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component

Topic 9: Lighting & Reflection models. Lighting & reflection The Phong reflection model diffuse component ambient component specular component Topic 9: Lighting & Reflection models Lighting & reflection The Phong reflection model diffuse component ambient component specular component Spot the differences Terminology Illumination The transport

More information

Simple Lighting/Illumination Models

Simple Lighting/Illumination Models Simple Lighting/Illumination Models Scene rendered using direct lighting only Photograph Scene rendered using a physically-based global illumination model with manual tuning of colors (Frederic Drago and

More information

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading) Lecture 9 Graphics pipeline (rasterization and shading) Graphics pipeline - part 1 (recap) Perspective projection by matrix multiplication: x pixel y pixel z canonical 1 x = M vpm per M cam y z 1 This

More information

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2

Illumination. Michael Kazhdan ( /657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2 Illumination Michael Kazhdan (601.457/657) HB Ch. 14.1, 14.2 FvDFH 16.1, 16.2 Ray Casting Image RayCast(Camera camera, Scene scene, int width, int height) { Image image = new Image(width, height); for

More information

The Rendering Equation. Computer Graphics CMU /15-662, Fall 2016

The Rendering Equation. Computer Graphics CMU /15-662, Fall 2016 The Rendering Equation Computer Graphics CMU 15-462/15-662, Fall 2016 Review: What is radiance? Radiance at point p in direction N is radiant energy ( #hits ) per unit time, per solid angle, per unit area

More information

Complex Shading Algorithms

Complex Shading Algorithms Complex Shading Algorithms CPSC 414 Overview So far Rendering Pipeline including recent developments Today Shading algorithms based on the Rendering Pipeline Arbitrary reflection models (BRDFs) Bump mapping

More information

TEAMS National Competition High School Version Photometry Solution Manual 25 Questions

TEAMS National Competition High School Version Photometry Solution Manual 25 Questions TEAMS National Competition High School Version Photometry Solution Manual 25 Questions Page 1 of 15 Photometry Questions 1. When an upright object is placed between the focal point of a lens and a converging

More information

Chapter 26 Geometrical Optics

Chapter 26 Geometrical Optics Chapter 26 Geometrical Optics 26.1 The Reflection of Light 26.2 Forming Images With a Plane Mirror 26.3 Spherical Mirrors 26.4 Ray Tracing and the Mirror Equation 26.5 The Refraction of Light 26.6 Ray

More information

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson Ray Tracing Part 1 CSC418/2504 Introduction to Computer Graphics TA: Muhammed Anwar & Kevin Gibson Email: manwar@cs.toronto.edu Overview Introduction / Motivation Rasterization vs Ray Tracing Basic Pseudocode

More information

Ray Tracer Due date: April 27, 2011

Ray Tracer Due date: April 27, 2011 Computer graphics Assignment 4 1 Overview Ray Tracer Due date: April 27, 2011 In this assignment you will implement the camera and several primitive objects for a ray tracer, and a basic ray tracing algorithm.

More information

dq dt I = Irradiance or Light Intensity is Flux Φ per area A (W/m 2 ) Φ =

dq dt I = Irradiance or Light Intensity is Flux Φ per area A (W/m 2 ) Φ = Radiometry (From Intro to Optics, Pedrotti -4) Radiometry is measurement of Emag radiation (light) Consider a small spherical source Total energy radiating from the body over some time is Q total Radiant

More information

Shading 1: basics Christian Miller CS Fall 2011

Shading 1: basics Christian Miller CS Fall 2011 Shading 1: basics Christian Miller CS 354 - Fall 2011 Picking colors Shading is finding the right color for a pixel This color depends on several factors: The material of the surface itself The color and

More information

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch

Lighting and Shading Computer Graphics I Lecture 7. Light Sources Phong Illumination Model Normal Vectors [Angel, Ch 15-462 Computer Graphics I Lecture 7 Lighting and Shading February 12, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Light Sources Phong Illumination Model

More information

Illumination in Computer Graphics

Illumination in Computer Graphics Illumination in Computer Graphics Ann McNamara Illumination in Computer Graphics Definition of light sources. Analysis of interaction between light and objects in a scene. Rendering images that are faithful

More information

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models Computergrafik Matthias Zwicker Universität Bern Herbst 2009 Today Introduction Local shading models Light sources strategies Compute interaction of light with surfaces Requires simulation of physics Global

More information

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

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017 CS354 Computer Graphics Ray Tracing Qixing Huang Januray 24th 2017 Graphics Pipeline Elements of rendering Object Light Material Camera Geometric optics Modern theories of light treat it as both a wave

More information

TEAMS National Competition Middle School Version Photometry Solution Manual 25 Questions

TEAMS National Competition Middle School Version Photometry Solution Manual 25 Questions TEAMS National Competition Middle School Version Photometry Solution Manual 25 Questions Page 1 of 14 Photometry Questions 1. When an upright object is placed between the focal point of a lens and a converging

More information

Ray tracing. EECS 487 March 19,

Ray tracing. EECS 487 March 19, Ray tracing EECS 487 March 19, 2007 http://radsite.lbl.gov/radiance/book/ 1 Conventional pipeline (rasterization) For each triangle Compute lighting at vertices For each pixel within triangle Compute interpolated

More information

Comp 410/510 Computer Graphics. Spring Shading

Comp 410/510 Computer Graphics. Spring Shading Comp 410/510 Computer Graphics Spring 2017 Shading Why we need shading Suppose we build a model of a sphere using many polygons and then color it using a fixed color. We get something like But we rather

More information

INF3320 Computer Graphics and Discrete Geometry

INF3320 Computer Graphics and Discrete Geometry INF3320 Computer Graphics and Discrete Geometry Visual appearance Christopher Dyken and Martin Reimers 23.09.2009 Page 1 Visual appearance Real Time Rendering: Chapter 5 Light Sources and materials Shading

More information

Questions??? Announcements Assignment 3 due today

Questions??? Announcements Assignment 3 due today Announcements Assignment 3 due today Questions??? Remember that you have late days (if you haven t used them yet ) Problem set 3 out at the end of the day Movie for Assignment 2 at the end of class 1 Ray

More information

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside

CS130 : Computer Graphics Lecture 8: Lighting and Shading. Tamar Shinar Computer Science & Engineering UC Riverside CS130 : Computer Graphics Lecture 8: Lighting and Shading Tamar Shinar Computer Science & Engineering UC Riverside Why we need shading Suppose we build a model of a sphere using many polygons and color

More information

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

Graphics 2009/2010, period 1. Lecture 8: ray tracing Graphics 2009/2010, period 1 Lecture 8 Ray tracing Original plan Finish the basic stuff (book ch 1-9) today: We will not look into signal processing (chapter 4) We will look at triangle rasterization (cf.

More information

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer by Emmanuel Agu Ray Casting (Appel, 1968) direct illumination Recursive ray tracing (Whitted, 1980) Pseudocode for Ray Tracer

More information

Introduction to Visualization and Computer Graphics

Introduction to Visualization and Computer Graphics Introduction to Visualization and Computer Graphics DH2320, Fall 2015 Prof. Dr. Tino Weinkauf Introduction to Visualization and Computer Graphics Visibility Shading 3D Rendering Geometric Model Color Perspective

More information

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

Lighting. To do. Course Outline. This Lecture. Continue to work on ray programming assignment Start thinking about final project To do Continue to work on ray programming assignment Start thinking about final project Lighting Course Outline 3D Graphics Pipeline Modeling (Creating 3D Geometry) Mesh; modeling; sampling; Interaction

More information

Lighting affects appearance

Lighting affects appearance Lighting affects appearance 1 Source emits photons Light And then some reach the eye/camera. Photons travel in a straight line When they hit an object they: bounce off in a new direction or are absorbed

More information

Lecture 15: Shading-I. CITS3003 Graphics & Animation

Lecture 15: Shading-I. CITS3003 Graphics & Animation Lecture 15: Shading-I CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Learn that with appropriate shading so objects appear as threedimensional

More information

Ray Tracing COMP575/COMP770

Ray Tracing COMP575/COMP770 Ray Tracing COMP575/COMP770 1 Ray tracing idea 2 Ray Tracing: Example (from [Whitted80]) Ray Tracing: Example Ray Tracing for Highly Realistic Images Volkswagen Beetle with correct shadows and (multi-)reflections

More information

COMP environment mapping Mar. 12, r = 2n(n v) v

COMP environment mapping Mar. 12, r = 2n(n v) v Rendering mirror surfaces The next texture mapping method assumes we have a mirror surface, or at least a reflectance function that contains a mirror component. Examples might be a car window or hood,

More information

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

CS580: Ray Tracing. Sung-Eui Yoon ( 윤성의 ) Course URL: CS580: Ray Tracing Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/gcg/ Recursive Ray Casting Gained popularity in when Turner Whitted (1980) recognized that recursive ray casting could

More information

At the interface between two materials, where light can be reflected or refracted. Within a material, where the light can be scattered or absorbed.

At the interface between two materials, where light can be reflected or refracted. Within a material, where the light can be scattered or absorbed. At the interface between two materials, where light can be reflected or refracted. Within a material, where the light can be scattered or absorbed. The eye sees by focusing a diverging bundle of rays from

More information

dq dt I = Irradiance or Light Intensity is Flux Φ per area A (W/m 2 ) Φ =

dq dt I = Irradiance or Light Intensity is Flux Φ per area A (W/m 2 ) Φ = Radiometry (From Intro to Optics, Pedrotti -4) Radiometry is measurement of Emag radiation (light) Consider a small spherical source Total energy radiating from the body over some time is Q total Radiant

More information

Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies" Ø The Hall illumination model. Ø Original ray tracing paper

Ø Sampling Theory Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling Strategies Ø The Hall illumination model. Ø Original ray tracing paper CS 431/636 Advanced Rendering Techniques Ø Dr. David Breen Ø Korman 105D Ø Wednesday 6PM 8:50PM Presentation 6 5/16/12 Questions from ast Time? Ø Sampling Theory" Ø Fourier Analysis Ø Anti-aliasing Ø Supersampling

More information

Assignment 6: Ray Tracing

Assignment 6: Ray Tracing Assignment 6: Ray Tracing Programming Lab Due: Monday, April 20 (midnight) 1 Introduction Throughout this semester you have written code that manipulated shapes and cameras to prepare a scene for rendering.

More information

Lighting and Reflectance COS 426

Lighting and Reflectance COS 426 ighting and Reflectance COS 426 Ray Casting R2mage *RayCast(R3Scene *scene, int width, int height) { R2mage *image = new R2mage(width, height); for (int i = 0; i < width; i++) { for (int j = 0; j < height;

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS SESSION 15 RAY TRACING 1 Announcements Programming Assignment 3 out today - overview @ end of the class Ray Tracing 2 Lecture Overview Review of last class Ray Tracing 3 Local

More information

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

Ray Tracing. CSCI 420 Computer Graphics Lecture 15. Ray Casting Shadow Rays Reflection and Transmission [Ch ] CSCI 420 Computer Graphics Lecture 15 Ray Tracing Ray Casting Shadow Rays Reflection and Transmission [Ch. 13.2-13.3] Jernej Barbic University of Southern California 1 Local Illumination Object illuminations

More information

Lecture 19: All Together with Refraction

Lecture 19: All Together with Refraction Lecture 19: All Together with Refraction December 1, 2016 12/1/16 CSU CS410 Fall 2016, Ross Beveridge & Bruce Draper 1 How about Interreflections? Note reflections Granite tabletop Visible on base Also

More information

TEAMS National Competition High School Version Photometry 25 Questions

TEAMS National Competition High School Version Photometry 25 Questions TEAMS National Competition High School Version Photometry 25 Questions Page 1 of 14 Telescopes and their Lenses Although telescopes provide us with the extraordinary power to see objects miles away, the

More information

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker CMSC427 Shading Intro Credit: slides from Dr. Zwicker 2 Today Shading Introduction Radiometry & BRDFs Local shading models Light sources Shading strategies Shading Compute interaction of light with surfaces

More information

Lab 9 - Metal and Glass

Lab 9 - Metal and Glass Lab 9 - Metal and Glass Let the form of an object be what it may, light, shade, and perspective will always make it beautiful. -John Constable Prologue Support code: /course/cs1230/src/labs/lab09 This

More information

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required: Watt, sections , (handout) Further reading:

Reading. Ray Tracing. Eye vs. light ray tracing. Geometric optics. Required: Watt, sections , (handout) Further reading: Reading Required: Watt, sections 1.3-1.4, 12.1-12.5.1 (handout) Further reading: Ray Tracing T. Whitted. An improved illumination model for shaded display. Communications of the ACM 23(6), 343-349, 1980.

More information

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Orthogonal Projection Matrices 1 Objectives Derive the projection matrices used for standard orthogonal projections Introduce oblique projections Introduce projection normalization 2 Normalization Rather

More information

Ray tracing Tutorial. Lukas Herzberger

Ray tracing Tutorial. Lukas Herzberger Ray tracing Tutorial Lukas Herzberger Agenda Ray tracing algorithm (lab 4a) Intersection tests Ray tracing algorithm (lab 4b) Hints & common mistakes Agenda Ray tracing algorithm (lab 4a) Intersection

More information

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media Specular reflection Lighting II CS 465 Lecture 19 Smooth surfaces of pure materials have ideal specular reflection (said this before) Metals (conductors) and dielectrics (insulators) behave differently

More information

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

Motivation. Sampling and Reconstruction of Visual Appearance. Effects needed for Realism. Ray Tracing. Outline Sampling and Reconstruction of Visual Appearance CSE 274 [Fall 2018], Special Lecture Ray Tracing Ravi Ramamoorthi http://www.cs.ucsd.edu/~ravir Motivation Ray Tracing is a core aspect of both offline

More information

Ray Tracing. CS116B Chris Pollett Apr 20, 2004.

Ray Tracing. CS116B Chris Pollett Apr 20, 2004. Ray Tracing CS116B Chris Pollett Apr 20, 2004. Outline Basic Ray-Tracing Intersections Basic Ray-Tracing Reference Point (i,j) Projection Plane Have a set up like in the above picture. Shoot rays from

More information

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

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

More information

Shading. Why we need shading. Scattering. Shading. Objectives

Shading. Why we need shading. Scattering. Shading. Objectives Shading Why we need shading Objectives Learn to shade objects so their images appear three-dimensional Suppose we build a model of a sphere using many polygons and color it with glcolor. We get something

More information

CS-184: Computer Graphics. Administrative

CS-184: Computer Graphics. Administrative CS-184: Computer Graphics Lecture #10: Raytracing Prof. James O Brien University of California, Berkeley V2005-10-1.1 Administrative Prof. O Brien away this Thursday and Friday Available after class today

More information

1. What is the law of reflection?

1. What is the law of reflection? Name: Skill Sheet 7.A The Law of Reflection The law of reflection works perfectly with light and the smooth surface of a mirror. However, you can apply this law to other situations. For example, how would

More information

Photorealism: Ray Tracing

Photorealism: Ray Tracing Photorealism: Ray Tracing Reading Assignment: Chapter 13 Local vs. Global Illumination Local Illumination depends on local object and light sources only Global Illumination at a point can depend on any

More information

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

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1 Ray tracing Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 3/19/07 1 From last time Hidden surface removal Painter s algorithm Clipping algorithms Area subdivision BSP trees Z-Buffer

More information

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #6: Lights Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016 Announcements Thursday in class: midterm #1 Closed book Material

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 S 3 Exam I Fall 25 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF Shading Introduction Affine transformations help us to place objects into a scene. Before creating images of these objects, we ll look at models for how light interacts with their surfaces. Such a model

More information

CS 465 Program 5: Ray II

CS 465 Program 5: Ray II CS 465 Program 5: Ray II out: Friday 2 November 2007 due: Saturday 1 December 2007 Sunday 2 December 2007 midnight 1 Introduction In the first ray tracing assignment you built a simple ray tracer that

More information

CPSC GLOBAL ILLUMINATION

CPSC GLOBAL ILLUMINATION CPSC 314 21 GLOBAL ILLUMINATION Textbook: 20 UGRAD.CS.UBC.CA/~CS314 Mikhail Bessmeltsev ILLUMINATION MODELS/ALGORITHMS Local illumination - Fast Ignore real physics, approximate the look Interaction of

More information

13 Distribution Ray Tracing

13 Distribution Ray Tracing 13 In (hereafter abbreviated as DRT ), our goal is to render a scene as accurately as possible. Whereas Basic Ray Tracing computed a very crude approximation to radiance at a point, in DRT we will attempt

More information

MITOCW MIT6_172_F10_lec18_300k-mp4

MITOCW MIT6_172_F10_lec18_300k-mp4 MITOCW MIT6_172_F10_lec18_300k-mp4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for

More information

Ray tracing idea. Ray Tracing. Ray tracing algorithm. Plane projection in drawing. CS 465 Lecture 3

Ray tracing idea. Ray Tracing. Ray tracing algorithm. Plane projection in drawing. CS 465 Lecture 3 Ray tracing idea Ray Tracing CS 465 Lecture 3 2007 Doug James 1 2007 Doug James 2 Ray tracing algorithm Plane projection in drawing for each pixel { compute viewing ray intersect ray with scene compute

More information