This is the homework page of Georg Petschnigg for Stanford's
Image Synthesis course.
Jump to Homework: 1 2 3
Final Project Page
Homework 1
The main goal of homework 1 was to familiarize myself with lrt - the literate
raytracer. Here are the results.
- What physical quantity do we measure along a ray?
First we measure the distance of the intersection point and ray origin and
the we integrate the spectral power density along the ray, This corresponds to
the contribution of this particular point in the final image.
- What lrt class is used to describe the reflection of light at a
point?
In order to describe the reflection of light at a point, lrt uses a class
called BSDF or “Bidirectional Scattering-Distribution Function”.
- How are vectors and normals treated differently?
Normals do not transform the same way as vectors do. If a sphere is non
uniformly scaled for example, the surface normal can not be treated as a
direction. Mathematically a normal is the cross product of two surface tangent
vectors. Tangents and vectors can be transformed with a standard
transformation matrix. Normals however, have to be transformed using the
inverse transpose of the transformation matrix.
- What's the difference between Intersect and IntersectP?
Shape::Intersect, returns information about a a single ray-shape
intersection corresponding to the intersection closest to the ray origin. The
other, Shape::IntersectP simply tells the caller whether or not an
intersection occurs, without specifying any details about the nature of the
intersection itself. The IntersectP routine is almost identical to
Intersect, but it does not fill in the DifferentialGeometry structure, nor
does it update the ray’s maxt field.
- How is the information about intersection between a ray and a shape
represented in lrt?
Intersect returns a boolean indicating whether the shape was hit, and
information about the hit if an intersection occurs. The hit itself is not
represented as a point, but rather as a small patch on the surface. This
information is stored in a DifferentialGeometry structure, that includes
position, normal, and tangents to the surface and surface parameters.
- What kind of coordinates are used to parameterize a triangle?
Barycentric coordinates are used to parameterize a triangle in terms of
two variables, u and v.
Here is a first rendering of my name:

Homework 2
For homework two we had to extend an existing raytracer called
lrt so that height fields would render more
efficiently. Finally the reflection and shading of the geometry of the objects
should be "phong" interpolated. This means object surface lighting would
appear "smoother", Here are some sample Images.
Original Version - crude faceted triangles visible
|
After changes - triangles are smoothly shaded
|
A more efficient algorithms runs about twice as fast
|
This image contains about 2 Million triangles
|
Homework 3
Homework three's assignment was to implement a "realistic" camera model for the lrt ray tracer.
First we had to implement depth of field effects, which are due to the finite
aperture size of a real camera. This causes objects which do not lie on the
image plane to become blurred. Here is an example:

Depth of Field |
Camera Settings
----------------------------------
Camera Mode: aperture_priority
Shutter Speed: 1/30sec
Focal Length: 1
F-Stop: F0.5
Aperture: 2
FOV: 45 degrees
Autofocus: ON
Sample Coords: 91 100
Focal Distance: 8.97172 Film gain: 37.892
|
In this image the camera is focused on the green cone. The blue and red cone
do not lie on the image plane and are thus blurred.
The second effect we had to implement was motion blur which is caused by camera
or object motion during a shot.

Motion Blur |
Camera Settings
----------------------------------
Camera Mode: shutter_priority
Shutter Speed: 1/0.2sec
Focal Length: 2
F-Stop: F12
Aperture: 0.166667
FOV: 45 degrees
Autofocus: ON
Sample Coords: 91 100
Focal Distance: 8.97172
Film gain: 37.5807
|
The final step was to implement an automatic focus and exposure system. I
implemented to following approach:
- Auto Focus
The algorithm attempts casts test rays starting from the center, alternating
left and right in ever increasing steps, until and object is hit. If no object
is hit in a scan line, the next scan line above, then below is tested, and so
on until there are not scan lines left. Once an intersection has occurred the
image plane is placed at that depth (example).
- Automatic Exposure
Instead of implementing an error prone exposure heuristic, I decided to
tweak the film sensitivity to match the illumination of the scene. This step
is performed posteriori after all the image sample have been computed. I find
the largest R, G, or B value and set the image gain to be the inverse of the
maximum RGB value. This way each sample is guaranteed to be within the 0 - 1
range. This approach breaks down if a intentionally dark scene is rendered, or
if an overly large dynamic range is required. In the end I favored this
approach, because to bright images can be easily corrected for.
- Shutter Priority Mode
In this mode the focal distance and film gain are set as described above.
The shutter speed is given by the user. The focal length is fixed to 2 and the
F-Stop is set to 12. I chose these values to reflect the aperture to mimic
traditional 35mm film camera settings. This mode gives the user full control
over exposure time allowing him or her to experiment with
motion blur effects.
- Aperture Priority Mode
Here again focal distance and film gain are automatically set. In this
case however the user has full control over the aperture size. This allows for
uninhibited depth of field effect exploration.
The exposure time is set to 1/30sec which as a rule of thumb is the largest
exposure time before a tripod is necessary.
- Programmed Mode
In this mode every setting is adjusted automatically. The film gain and
focal distance are set as described above. The shutter speed is fixed to
1/30sec, F-Stop to F12 and the focal length at 1. This mode comes close to the
"point & shoot" operation of a pocket camera (example).

Auto-focus selects Blue Cone |
Camera Settings
----------------------------------
Camera Mode: programmed
Shutter Speed: 1/30sec
Focal Length: 1
F-Stop: F12
Aperture: 0.0833333
FOV: 45 degrees
Autofocus: ON
Sample Coords: 37 100
Focal Distance: 13.2744
Film gain: 37.9423
|

Auto-focus selects Red Cone |
Camera Settings
----------------------------------
Camera Mode: programmed
Shutter Speed: 1/30sec
Focal Length: 1
F-Stop: F12
Aperture: 0.0833333
FOV: 45 degrees
Autofocus: ON
Sample Coords: 118 100
Focal Distance: 4.8298
Film gain: 37.9467
|

Auto-focus selects center first |
Camera Settings
----------------------------------
Camera Mode: programmed
Shutter Speed: 1/30sec
Focal Length: 1
F-Stop: F12
Aperture: 0.0833333
FOV: 33 degrees
Autofocus: ON
Sample Coords: 87 100
Focal Distance: 8.89726
Film gain: 37.9462
|

Auto-focus selects Blue Cone |
Camera Settings
----------------------------------
Camera Mode: programmed
Shutter Speed: 1/30sec
Focal Length: 1
F-Stop: F12
Aperture: 0.0833333
FOV: 33 degrees
Autofocus: ON
Sample Coords: 21 126
Focal Distance: 13.9287
Film gain: 37.9448
|