Ray Tracing - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Ray Tracing

Description:

Empirical specular term for highlights 'Ambient' term for indirect illumination ... Reflections/refractions (glossy objects, caustics) Lens effects ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 26
Provided by: mohdshahr
Category:
Tags: glossy | ray | tracing

less

Transcript and Presenter's Notes

Title: Ray Tracing


1
Ray Tracing
2
Illumination models realism
  • Weve been using the Phong lighting model for
    illumination.
  • Is it realistic?
  • Empirical specular term for highlights
  • Ambient term for indirect illumination
  • No illumination away from light give shadow-like
    effect, but
  • No cast shadows
  • No surface interreflection
  • No refraction through transparent or translucent
    objects including caustics

3
Global illumination
  • Global illumination techniques strive to include
    all of these physical phenomena.
  • In practice, they often do not.
  • Path tracing simulate light optics
  • Reflections/refractions (glossy objects,
    caustics)
  • Lens effects
  • Radiosity simulate light transfer
  • Diffuse-diffuse reflections (color bleeding)
  • Typically very expensive not interactive.

4
Forward vs Backward mapping
  • Weve been studying the traditional graphics
    pipeline.
  • Commonly referred to as forward mapping objects
    are transformed into image space to determine
    pixel coverage.
  • Ray tracing, a special case of path tracing,
    transforms pixels into object space to determine
    object contribution backward mapping.

5
Ray tracing
  • To determine the color of a given pixel
  • Create a ray from the eye, through the pixel, and
    into the world
  • Intersect the ray with all objects in the scene
  • Determine the visible surface
  • Directly displaying the first intersection is
    commonly referred to as ray casting.
  • As well see later, calling visibility ray
    tracing ray casting misses the point of what
    full ray tracing does different.

6
Visibility determination
Screen
Eyepoint
Scene
7
Lighting model
  • Once weve determined which object we can see
    along a particular ray, we have to determine
    color.
  • Assume we had triangles in the scene we could
    determine an intersection be first determining if
    the ray intersects the plane of the triangle,
    then where, then if where is inside.
  • We can now easily determine
  • Surface normal
  • View direction
  • Light direction
  • Texture coordinates
  • So we can apply whatever light model we want
    Phong for instance.

8
Shadows
  • Or we can take our first step toward a full ray
    tracing algorithm
  • We could trace a shadow-ray from the point of
    intersection toward the light and determine if
    some other object blocks the light source.

9
Inter-object reflections
  • We could trace a ray off reflective surfaces and
    determine if they hit objects if they do we
    compute the lighting equations for the secondary
    ray and determine the contribution of this
    reflection at the first intersection

10
Refraction
  • Transparent and translucent objects refract
    (bend) the light that passes through them. We
    could compute refracted rays and trace them as
    well.
  • We can calculate the angle from the indices of
    refraction of the two materials which interface
    at the ray-object intersection.

11
Recursive ray tracing
  • Full recursive ray tracing (as suggested by
    Whitted) does all of these at every intersection.

12
The good the bad
  • Good
  • Transparency
  • Reflections
  • Shadows
  • Conceptually simple / pretty easy to write no
    clipping, no projections, no scan conversion
  • Bad
  • Intersection tests are expensive
  • Intersection tests are expensive
  • Intersection tests are expensive
  • Typical framebuffer ? 1 million pixels
  • Typical scene 1 million polygons

13
Ray-object intersections
  • In general, we parameterize the ray and find the
    parameter value where the ray intersects the
    object.
  • Doing this for all objects, we keep the smallest
    non-negative parameter value thats the
    intersection with the first object along the ray.
  • From the intersection point, we can compute
    whatever surface properties we need.
  • How should we represent a ray?
  • So how do we compute intersections?

14
Ray representation
  • Whats a ray?
  • It has an origin and a direction.
  • Any point on the ray is just origin
    tdirection
  • So our intersection test just need to solve for t.

15
Ray-triangle intersection
  • Triangles are the most common model
    representation
  • Lowest common denominator
  • Can use hardware to accelerate
  • Basic approach
  • Find plane equation (from vertex coordinates)
  • Find intersection between ray and plane
  • Does triangle contain intersection point?
  • We can interpolate surface properties for this
    intersection from the vertices, but only if we
    need to separate this calculation from the
    intersection test.

16
Constructive Solid Geometry
  • Use Boolean operations to combine simple
    primitives into complex objects.
  • CSG models are typically represented as trees,
    Boolean operators make the nodes and geometric
    primitives make up the leaves.
  • A common modeling concept for any
  • kind of rendering, but its especially
  • easy to determine what the resulting
  • surface is for ray tracing.

17
Shadow rays area lights
  • We can sample instead
  • Add up contribution from shadow rays reaching the
    area light.
  • Trade-off instead of on very expensive test, we
    have several potentially expensive tests.

18
Shadow rays translucent shadowing
  • Translucent objects should cast colored shadows.
  • We can fake the colored shadows
  • Find all intersections along the ray.
  • If an object is translucent, attenuate the light
    accordingly.
  • Only give up if we hit an opaque object or too
    many translucent objects.
  • Whats wrong with this hack?

19
Lens effects
  • Typically, the camera model is that of a pin-hole
    camera.
  • We can easily insert a lens into the optical path
    and get the expected effects.

20
What bounding volume?
  • Spheres
  • Cheap intersection test
  • Typically a poor fit
  • Hard to cluster optimally see poor fit
  • Axis-aligned bounding boxes (AABBs)
  • Ray-box test we had before reasonably cheap
  • Easier to get good fits than spheres
  • Trivial clustering
  • Oriented bounding boxes (OBBs)
  • Medium intersection test
  • Very good fit (provably, asymptotically better
    than AABB)
  • Medium clustering difficulty

21
Spatial partitioning
  • Classification of space into non-overlapping
    portions
  • Uniform-grid
  • Octree
  • k-D tree
  • BSP-tree

22
Stochastic ray tracing
23
What cant ray tracing do?
24
What cant ray tracing do?
25
Radiosity can capture that
  • Radiosity models the transport of light between
    surfaces.
  • Part of full the radiosity solution is computing
    reflection between every pairing of surfaces.
  • If you really have time to kill, you could use
    the BRDF to drive stochastic sampling in a path
    tracer to get diffuse-diffuse reflections.
  • It would probably actually be slower than the
    radiosity solution for less accurate results, but
    in the limit it would converge to the right
    thing.
Write a Comment
User Comments (0)
About PowerShow.com