Project 1 Help Session
CS 348B - Computer Graphics: Image Synthesis Techniques
Spring Quarter, 1998
Marc Levoy
TA: Tamara Munzner
If you're taking the class for credit, check
student list . If you're not listed, fill out the online
questionnaire
.
Outline
- Assignment overview
- The /usr/class/cs348b tree
- Going from the xsupport example program to a working raytracer
- what's provided: example.c
- what you have to write
- composer constants
- FAQ
Assignment overview
Project Assignment (HO #7)
- C or C++:
- Read the README files in /usr/class/cs348b/
- Only need to handle spheres and triangles
- HW1: One material per object, per-face normals
- HW2: per-vertex normal, material
- Don't optimize yet
The /usr/class/cs348b tree
- README
- README.composer
- README.submit
- README.xsupport
- README.porting
- bin/
(only on SGIs)
- composer
- i3dm
- i3dm_clean
- iv2out (ignore)
- out2out (ignore)
- snoop
- supersnoop
- submit
- example/
- (start here -- copy to your directory)
- (uses scene_io and xsupport)
- include/
- init/
- lib/
- proj1/
- README
- tests/
- README
- testx.iv
- testx.out
- testx.rgb
- resources/
- XXX/Xresources (used by cs348b/init/init.csh)
- tools/
- composer/ (includes source code)
- iv2out/ (ignore)
- out2out/ (ignore)
- soft2out/ (ignore)
- i3dm/
- models/
- movies/
- textures/
- (John Kichury's modelling package supporting materials)
- useful-code/
- README
- (Graphics Gems vector and matrix algebra routines)
- xsupport/
- obj/
- src/
- (Source to recompile xsupport, to run on other platforms)
- (Uses Motif widget library)
Going from the xsupport example program to a working raytracer
- What's provided: example.c
- Demonstrates widgets for your control box
- Starts with two Canvases
ReadComposer()
and LoadScene(char *name)
- Reads scene (e.g. testx.out)
- (see /usr/class/cs348b/include/scene_io.h
for data structures)
- structures: SceneIO, CameraIO, LightIO,
ObjIO, MaterialIO, VertexIO, PolygonIO
- writes scene out in ASCII (to verify it)
- deletes the scene
-
LoadPPM()
-
SavePPM()
-
main()
- Initialize Canvases
- Calls
LiftOff()
- After this, user events trigger
callback functions
- What you have to write
- Modify control widgets to do meaningful things, such as
control ray tree depth and image size
- Modify
ReadComposer()
and
LoadScene(char *name)
so that you don't delete the scene
immediately
- Write
Render()
- Chap 7 Sec 3 by Heckbert in Glassner book is your friend
- Screen, Trace, Shade, Intersect
- raytrace the scene to the canvas image buffer
-
UpdateCanvas()
, so you can see the image
- Composer constants
(from README.composer)
- Whitted's Eqn (16.55 of FvDH):
I = ka Ia Od +
Sumi (
Si fatti Ipi [
kd Od (N*Li) +
ks (N*Hi)n ]
) +
ks Ir + kt It
- (kd*Od) is given by "diffColor"
- Composer outputs a single "ambient color", whereas the ambient
term in Whitted's equation is given by ka
Ia Od. We suggest treating the
ambient color you get from Composer as Ia and
multiplying it by the diffuse color Kd
Od to get your ambient term.
- For (semi-)transparent surfaces, you should probably multiply
the diffuse and ambient terms by (1-kt).
Otherwise, the diffuse and transmitted rays will add up,
and the surface will become washed-out.
- ks is given by "specColor". Note that the latter
is a vector which has all three values identical. This
value is ks. The redundancy is being maintained
for historical reasons.
- For assignment 1, always use a refractive index of 1.5 where
applicable.
- Ignore the emissive component output by composer.
- For n, use shininess*128 (where shininess is composer's
shininess output between 0 and 1).
- For fatt (attenuation of light sources),
use FvDFH equation 16.8
( fatt = min(1, 1 / (
c1 + c2 dL +
c3 dL2
) ), with
c1 = 0.25, c2 = 0.1 and c3
= 0.01. (If your results don't look satisfactory to you,
feel free to play with this parameter). Secondary
rays (reflected and transmitted rays) are not attenuated.
- Use an aspect ratio of 1 for the screen.
- The ambient colors and headlight strength output by Composer may
be scaled such that if you blindly implement Whitted's
equation, your scenes may appear washed out. Scale these
factors until your ray traced image looks roughly similar
to the sample images in /usr/class/cs348b/proj1/tests.
[email protected]
Copyright © 1998 Marc Levoy
Last modified Fri Apr 10 02:51:21 1998