« previous | Wednesday, March 19, 2014 | next »
Surfaces
Implicit
Defined by a function; points are not directly defined.
For example, a sphere is defined by the function
Shapes that are easy to define implicitly are:
- spheres
- planes
- cylinders
- cones
- tori
These types of shapes are easy for raytracers to handle.
Intersections
Given a ray that starts at a point and extends to infinity in the direction of , find the intersection of with :
Substitute for in the function and solve for in .
Example: and
The solution to the intersection is , so and .
Normals
Given , find the normal at a point
Assume we have a parametric curve on the surface of , we set and differentiate with respect to :
This represents conceptually the dot product between what must be the normal of the surface and the slope of a line on the surface (i.e. must be tangent to the surface)
Summary
Advantages
- easy to calculate intersections and normals
Disadvantages:
- hard to calculate points on the surface
Parametric
Intersections
Set , and solve a system of three equations (each of , , and ) for the parameters , , and .
Plug parameters back into equation to find solution.
Example: and
Normals
Assume is fixed. Set and differentiate with respect to :
The RHS represents the tangent at
Perform a similar operation with :
The RHS represents the tangent at .
To find the normal, take cross product of tangents:
Summary
Advantages:
- easy to generate points on surface
Disadvantages:
- hard to determine if point is inside or outside
- hard to determine if point is on the surface
Deformed
Given a surface and a deformation function , is a new surface representing the deformed surface.
This is useful for creating complicated shapes from simple objects.
Intersections
- Assume is a simple matrix (e.g. affine transformation)
- First deform by
- Calculate intersection with undeformed surface
- Transform intersection point and normal by .
Example: deformation of a circle that stretches by factor of two in the direction:
Normals
Define how tangents transform first. Assume is a curve on the surface:
Tangents deform by applying transformation (multiply by matrix)
Normals and tangents are orthogonal both before and after transformation.
Let be the normal and be the tangent:
Hence
Normals transform by the inverse transpose of the deformation matrix, NOT by the deformation matrix.
(why? normal vectors are covectors, not vectors)
Summary
Advantages
- simple surfaces can represent complex shapes
- affine transformations yield simple calculations
- If we are given , we never have to compute any matrix inverse.
Disadvantages