Raytracing (Part 5) - Intersection with Cubes, Convex Polyhedra, and Meshes, Slides of Computer Graphics

The raytracing techniques for intersecting rays with cubes, convex polyhedra, and meshes. It covers the candidate interval concept, testing against planes, and implementation details. The document also provides references to the textbook for further reading.

Typology: Slides

2012/2013

Uploaded on 04/27/2013

astii
astii 🇮🇳

4.3

(15)

111 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer Graphics
Raytracing (Part 5)
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Raytracing (Part 5) - Intersection with Cubes, Convex Polyhedra, and Meshes and more Slides Computer Graphics in PDF only on Docsity!

Computer Graphics Raytracing (Part 5)

Today..

n Cube and mesh hit( ) functions

n Antialiasing

Recall: Candidate Interval (CI)

n Define Candidate Interval (CI) as time interval during which edge might still be inside CVV. i.e. CI = t_in to t_out

n Conversely: values of t outside CI = edge is outside CVV

n Previously used CI initialized to [0,1], now can exceed this range

n Initialize CI to (-infinity, infinity)

t

t_in t_out

CI

Candidate Interval (CI)

Example to illustrate search for t_in, t_out

Note: CVV is different shape. This is just example

Testing against Planes

n To solve for intersection times with each plane, put ray

equation into implicit equation for plane

n And t_hit is given as

n Where numer = m. (B - S)

n And denom = m.c

S t B

F P P B

m c

m

denom

numer

t =

Testing against Planes

n Where numer = m. (B - S) , denom = m.c

n If denom = 0, ray is parallel to plane, numer determines if

it is wholly inside or outside

n numer > 0, wholly inside n numer < 0, wholly outside

n If denom > 0, means ray is passing into outside half of

plane, since m.c are less than 90 degrees apart

n If denom < 0, means ray is passing into inside half of

plane, since m.c are less than 90 degrees apart

Intersection with Convex Polyhedra

n Implementation for cube function is nicely laid out in figure 14.23 of text. Please read it..

n We’ve seen enough hit functions to last you a life time

n Read on your own..

n For convex polyhedra, instead of 6 faces for cube, store i faces

n Find normal to face i, mi and hit point Bi. Use loop then as

for(int i=0;i < N;i++)

numer = dot3D( mi, Bi - S )

denom = dot3D( mi, c)

… continue same as cube

}

Intersection with Mesh

n We can then extend method to develop hit function for a mesh

n Retrieve normal of mesh and vertex 0

n Read mesh intersection part from book (1/2 page)

for(int f=0;f < numFaces;f++)

Vector3 diff;

Vector3 normal(norm[face[f].vert[0].normIndex);

Point3 point(pt[face[f].vert.vertIndex);

form diff = point – genRay.start

numer = dot3D(normal, diff)

denom = dot3D(normal, genRay.dir )

… continue same as cube

}