Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ray Tracing Forward Ray Tracing

Similar presentations


Presentation on theme: "Ray Tracing Forward Ray Tracing"— Presentation transcript:

1 Ray Tracing Forward Ray Tracing
Modeling interaction of light with the objects/surfaces Problem: Many rays will not contribute to the image!

2 Ray Tracing Backward Ray Tracing
Rays from camera (viewer) through each pixel to the scene Backward Ray Tracing = Ray Tracing

3 Primary and Secondary Rays
Ray Tracing Backward Ray Tracing Primary and Secondary Rays D B Viewer E C A View Plane F

4 Ray Tracing Backward Ray Tracing Shadow Rays
Visibility check with respect to the light source

5 Ray Tracing Ray Casting D B Viewer E C A View Plane F

6 Ray Tracing Two Issues Ray-object intersection
Visibility test: Closest to the viewer Pixel color determination (shading) Illumination model

7 Ray Tracing Ray Object Intersection Sphere Rd Ro

8 Ray Tracing Ray Object Intersection Sphere Implicit Form
Center Sc = [ Xc Yc Zc ] Radius Sr Surface Point [ Xs Ys Zs ]

9 Ray Tracing Ray Object Intersection Sphere
To solve the intersection problem the ray equation is substituted into the sphere equation and the result is solved for t That is

10 Ray Tracing Ray Object Intersection Sphere

11 [ Xi Yi Zi ] = [ Xo + Xdt , Yo + Ydt , Zo + Zdt ]
Ray Tracing Ray Object Intersection Sphere Smaller positive among t0 and t1 gives the closest intersection point [ Xi Yi Zi ] = [ Xo + Xdt , Yo + Ydt , Zo + Zdt ]

12 Ray Tracing Ray Object Intersection Sphere Normal

13 Ray Tracing Ray Sphere Intersection Sum up Calculate A B C
Compute the discriminant Calculate min (t0 , t1) Compute the intersection point Compute the normal

14 Ray Tracing Ray Object Intersection Sphere Geometric Approach tca thc
Rd d r R0 L O

15 Ray Tracing Ray Object Intersection Sphere Geometric Approach tca thc
Rd d r R0 L O

16 Ray Tracing Ray Object Intersection Sphere Geometric Approach tca thc
Rd d r R0 L O

17 Ray Tracing Ray Object Intersection Sphere Geometric Approach tca thc
Rd d r R0 L O

18 Ray Tracing Ray Plane Intersection Ray Ro = [ Xo Yo Zo ] (ray origin)
Rd = [ Xd Yd Zd ] (ray direction) Xd2 + Yd2 + Zd2 =1 (normalized) R(t) = Ro + Rdt t > 0 Plane P : Ax + By + Cz + D = 0 A2 + B2 +C2 = 1 Pnormal = Pn = [ A B C ] D : Distance from origin

19 Ray Tracing Ray Plane Intersection
Substituting ray equation in plane’s equation A ( Xo + Xdt ) + B (Yo + Ydt ) + C ( Zo + Zdt ) + D = 0 Solving for t

20 Ray Tracing Ray Plane Intersection Let
If Vd = 0 then the ray is parallel to the plane (no intersection) Vd > 0 normal is pointing away from the ray (may be used for back-face culling) Normal Ray

21 Ray Tracing Ray Plane Intersection Let
If t < 0 then plane is behind ray’s origin else compute intersection ri = [ Xi Yi Zi ] = [Xo + Xdt , Yo + Ydt , Zo + Zdt ] rnormal = Pn Let

22 Ray Tracing Polygon Intersection Containment Test
Parity Test: If the number of intersection is odd then point is inside (special case for vertices)

23 Triangle: Barycentric Coordinates
Ray Tracing Triangle Intersection Containment Test Triangle: Barycentric Coordinates V3 P V1 V2

24 Triangle: Barycentric Coordinates
Ray Tracing Triangle Intersection Containment Test Triangle: Barycentric Coordinates V3 A2 P A1 Total A V1 V2 A3 Area Coordinates

25 Triangle: Barycentric Coordinates
Ray Tracing Triangle Intersection Containment Test Triangle: Barycentric Coordinates V3 A2 A1 P V1 V2 A3

26 Ray Tracing Ray Quadric Intersection Quadrics:
Cylinders, Cone, Sphere, Ellipsoids, Paraboloids, Hyperboloids, etc. Implict form f(X,Y,Z) = 0 Ax2 + 2Bxy + 2Cxz + 2Dx + Ey2 +2Fyz +26y + Hz2 + 2Iz +J = 0 Ray: Parametric form Ro = [ Xo Yo Zo ] (ray origin) Rd = [ Xd Yd Zd ] (ray direction) Xd2 + Yd2 + Zd2 =1 (normalized) R(t) = Ro + Rdt t > 0

27 Ray Tracing Ray Quadric Intersection Matrix Form f(X,Y,Z) = 0

28 Ray Tracing Ray Quadric Intersection Substituting

29 Ray Tracing Ray Quadric Intersection Normal

30 3D Clipping: Cyrus Beck/Liang Barsky
Ray Tracing Ray Box Intersection 3D Clipping: Cyrus Beck/Liang Barsky


Download ppt "Ray Tracing Forward Ray Tracing"

Similar presentations


Ads by Google