Docsity

Advanced Computer Graphics: Ray-Object Intersections and Bounding Boxes, Slides of Computer Graphics

Partial preview of the text

Download Advanced Computer Graphics: Ray-Object Intersections and Bounding Boxes and more Slides Computer Graphics in PDF only on Docsity!

Advanced Topics in

Computer Graphics

Ray-Object Intersections

Shooting Rays

Bounding Boxes ยƒ Simple Objects ยƒ Generic Objects ยƒ Part Objects ยƒ Compound Objects ยƒ More?

Bounding Box

Box Representation

Bottom Left = Pl = (x1,y1,z1) ยƒ Bottom Right = Pr = (x2,y2,z2)

Code to Compute Hit or Miss

Page 358 Ray Tracing From the Ground Up

Software Deign Considerations

public class ConcreteObject extends GeometricObject { private BoundingBox box;public boolean hit(Ray ray){ if (!box.hit(ray)) return; โ€ฆ } @Override public boolean getBoundingBox(){return box;} }

Simple Objects

Planes

Spheres

Triangles

Disks

Sphere

Equation of a Sphere

(p โ€“ c)*(p โ€“ c) โ€“ r 2

Drop in the Equation of A Ray

(o + td โ€“ c) * (o + td โ€“ c) โ€“ r 2

Gives Quadratic Equation (at

2

+ bt + c = 0)

a = d*d ยƒ b = 2 (o โ€“ c) * d ยƒ c = (o โ€“ c) * (o โ€“ c) โ€“ r 2

Can have 0, 1 or 2 Solutions for t

Normal

(o-p)

Triangle

Defined as three points (q,r,s)

points must not be colinear

Normal

(q โ€“ r) x (s โ€“ r)

Barycentric Coordinates

p(a,b,y) = qa + rb + sy ยƒ a + b + y = 1 ยƒ For inside the triangle ยƒ (a,b,y)  (0,1) 3 ยƒ Substituting (a = 1 โ€“ b โ€“ y) gives ยƒ p(a, b, y) = q + b (r โ€“ q) + y (s โ€“ q) ยƒ (b,y,b+y)  (0,1) 3

Disk

Very Simple

Calculate the hitpoint on the plane ยƒ Measure the distance from the center of the diskto the hit point ยƒ Save time ยƒ Donโ€™t calculate SQRT Docsity.com

Generic Objects

What are Generic Objects? ยƒ Objects where ยƒ Example ยƒ Sphere ยƒ r= ยƒ Center = (0,0) ยƒ Why? ยƒ We can only ray trace objects we can

  1. Derive the Ray-Intersection Equation2. Solve the Ray-Intersection Equation ยƒ Generic Objects provide another technique for solving the ray-intersection equation ยƒ If we can solve the equation for a generic object, we can solvethe equation for any linear transformation of that object

Part Objects

Cylinder

Limit the y values ยƒ Limit the angle ยƒ Must compute the hist point angle

Sphere

Limit y values ยƒ Limit angle

Tori

Limit Either of the angles

Compound Objects

Can create more interesting objects

Solid Cylinder

Leads to Hierarchal Bounding Boxes

Current Work

How do we speed up IntersectionCalculations?

Bounding Boxes ยƒ Regular Grids ยƒ Hierarchal Grids ยƒ Dividing objects into space boxes ยƒ Dividing rays into categories ยƒ See paper (Fast Ray Tracing by Ray Classification)

Meshes

Low Rez

3 ยƒ High Rez

5 ยƒ Better Models

7

Further Reading

Calculus (3D)

Linear Algebra