Today we want to gain experience in doing a quantitative calculation:

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT

- a
**geomtrical**aspect: Where do all the rays go, and what do they see ? -- and how do we determine this efficiently ? - a
**statistical**aspect: The rays are only "samples" into the scene. How many samples should be taken to result in a decent picture ? - a
**physical**aspect: What interactions does the light have with the given material in the scene, wherever a ray hits a surface ?

I'

I'

This kind of computation has to be done by your raytracer every time it hits a surface !

In the simplest case, each pixel is sampled according to a regular grid (i.e. 2, 3, or 4 samples per pixel edge). This is equivalent of assuming that you have screen in which the number of pixels in the horizontal and vertical directions are increased by an interger multiple.

In a more sophisticated program the individual super-sampling rays would be randomized in their positions within a pixel.

This one basic trick:

Anti-aliasing of high spatial frequencies

Smooth reflections and refractions

Soft Shadows

Fuzzy Reflections on brushed aluminium, brushed table top; (more brushed metal)

Caustics from reflections, from refractions, in swimming pool

Depth of Field - distribution sampling over aperture of lens

Motion Blur - distribution sampling over inter-frame time interval

Triangle in barycentric coordinates: X(β, γ) = V1+β(V2−V1)+γ(V3−V1)

Combine: V1+β(V2−V1)+γ(V3−V1) = A+tD

Solve for β, γ, and t: -- 3 equations with 3 unknowns; -- danger: divide by near-zero; -- check ranges.

Ray passes through box, if the union of all three inside-intervals [ (x

Instantiate all objects in your logical scene hierarchy (these could be spheres sprinkled by a generator program, or triangle meshes read in as OBJ files).

Now you have hierarchically flat, fully instantiated "sea of spheres and triangles"; determine the centroid sor each primitive, and the overall bounding box around the whole scene.

Pick the longest axis of this bounding box, and sort all centroids along this axis; then split the whole population at the median into two halves of equal magnitude.

Recursively continue this splitting process for the two halves.

When you have created the complete binary tree, recursively from the leaves to the root, create a nested bounding box hierarchy starting with the bounding boxes of the leaf-primitives.

Compare the rendering times in your ray-tracer with and without using this data structure.

And there are other methods to create efficient testing of Ray-Scene intersections . . .

Shirley, 2nd Ed:

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT

Page Editor: Carlo H. Séquin