Lecture16-RayTracingIntersections

Lecture16-RayTracingIntersections - CS 455 Computer...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 455 – Computer Graphics Ray-Object Intersections
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Implicit and Parametric Forms Implicit form § f(x,y) = 0 example: y – 3x + 2 = 0 is a line. § The curve/line/plane/whatever exists at values of f(x,y) that equal 0. § To find the curve/line/plane/whatever plug in values of x,y into f and see if they are 0. § f(x,y) defines a terrain and altitude = 0 is the curve. Parametric form § Looks like § Think of a particle with position at time t given by g(t), h(t). = ) ( ) ( t h t g y x
Background image of page 2
Implicit form of a ray
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Math Problem of the Day Given a line in implicit form § y = mx + b Convert it to the form § Ax + By + C = 0 Such that the equation is valid for lines that § Pass through origin § Are vertical § Are horizontal
Background image of page 4
Points and Planes Equation of a plane Plane Normal Distance from Plane to Origin Distance from point To Plane Given Points Distance between points: ( 29 ( 29 ( 29 2 1 2 2 1 2 2 1 2 2 1 ) , ( z z y y x x p p dist - + - + - = 0 = + + + D Cz By Ax ( 29 C B A , , D ( 29 1 1 1 , , z y x p = 0 = + + + D Cz By Ax ( 29 1 1 1 1 , , z y x p = ( 29 2 2 2 2 , , z y x p = 2 2 2 1 1 1 C B A D Cz By Ax dist + + + + + =
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Recap implicit vs. explicit
Background image of page 6
Many objects can be represented as implicit surfaces: § Sphere (with center at c and radius R ) : fsphere ( p ) = || p c ||2 - R 2 = 0 § Plane (with normal n and distance to origin d ) : fplane ( p ) = p · n + D = 0 To determine where a ray intersects an object: § Need to find the intersection point p of the ray and the object § The ray is represented explicitly in parametric form: r ( t ) = r o + r dt § Plug the ray equation into the surface equation and solve for t : f ( r ( t )) = 0 § Substitute t back into ray equation to find intersection point p : p = r ( t ) = r o + r dt Ray-Object Intersections
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A ray can be represented explicitly (in parametric form) as an origin (point) and a direction (vector) : § Origin: § Direction: The ray consists of all points: r ( t ) = r o + r dt Recall: Ray Representation r o = r (0) r (–1) r o + r d = r (1) r (2) r (3) = o o o o z y x r = d d d d z y x r
Background image of page 8
§ Sphere is represented as: - center (point): Sc = (xc, yc, zc) - and a radius (float): r § The surface of the sphere is the set of all points (x, y, z) such that: (x-xc)2 + (y - yc)2 + (z - zc)2 = r2 § In this form (implicit form), it is difficult to directly generate surface points § However, given a point, it is easy to see if the point lies on the surface § To solve the ray-surface intersection, substitute the ray equation into the sphere equation. Ray-Sphere Intersections
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 53

Lecture16-RayTracingIntersections - CS 455 Computer...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online