CS 348B - Computer Graphics: Image Synthesis Techniques
HW1 - Hello, World
Assigned Thursday, April 4. Due Thursday, April 11
This assignment will introduce you to using lrt and simple modelling tools.
- Copy /usr/class/cs348b/files/lrt.tar.gz to your working directory.
- Type gunzip lrt.tar.gz in the directory with lrt.tar.gz. The result is a file named lrt.tar.
- Type tar xvf lrt.tar. This will extract the files you need into a new directory called lrt.
- Compile lrt. The Makefile provided should work for the machines in the Sweet Hall lab.
Once you have successfully compiled lrt, you can try rendering some images.
You will see some messages from lrt, and it will begin printing a sequence of '+'s to the screen to let you know it is working. After a minute or so (it will print about 50 '+'s), the rendering will finish. You will have a new image, hello.tiff, in your directory. View this with your favorite image viewer. For your convenience, we provide a simple image viewer called iv, which you can find in the /usr/class/cs348b/bin/ directory. In any case, congratulations! You've rendered your first image with lrt.
- Copy the file /usr/class/cs348b/rib/hello.rib to your working directory.
- Type lrt hello.rib to begin rendering.
Have a look at the beginning of hello.rib - it is a text file. The first few lines are comments, followed by commands that specify the desired image resolution and format. Try reducing the resolution to half the current size, and reducing the pixel samples from 2x2 to 1x1, and render the scene again. It will be smaller and have some jaggies, but it will render much quicker. This is good to know: later in the quarter when you're writing code, you'll want to do lots of quick and dirty renders for debugging.
Next in the hello.rib file are commands to set up the camera and specify a view transformation matrix. Finally, after the WorldBegin line, you will find the description of the scene. You should be able to figure out the meaning of the lines that describe the two light sources. The polygon meshes that fill the rest of the file are not terribly human-reader-oriented, but you can spot the lines that specify surface shaders and colors for materials. Experiment with changing the colors of materials and lights, and with changing the position of the light sources.
You will find several other scene files in the /usr/class/cs348b/files/rib/ directory. Feel free to experiment. You can find detailed information about the RIB file format through the links in the Resources page.
You can find the lrt book in acrobat form in: /usr/class/cs348b/files/lrt.pdf. Note that Acrobat Reader is installed on the Sweet Hall machines, and can be started by typing acroread. You should read through the first three chapters of the lrt book.
As a quick check on what you've read, answer the following questions about lrt. One line (and sometimes one word) answers for each will suffice.
- What physical quantity do we measure along a ray?
- What lrt class is used to describe the reflection of light at a point?
- How are vectors and normals treated differently?
- What's the difference between Intersect and IntersectP?
- How is the information about intersection between a ray and a shape represented in lrt?
- What kind of coordinates are used to parameterize a triangle?
This quarter, we'll provide you with a free Linux modelling tool called Moonlight. You can read about it and find tutorials at http://www.moonlight3d.net. Moonlight is installed for the class in /usr/class/cs348b/moonlight/. If you want to try it on another machine (Linux only) you can retrieve the setup either from the Moonlight website, or from the files section of the class directory (/usr/class/cs348b/files/moonlight-setup-0.9.2-beta.tar.gz). You are also free to work with another modelling package of your choice, such as Maya, but you must ensure that any RIB files you generate can be parsed by lrt (which is not fully RenderMan compliant).
To start Moonlight, run moonlight in the directory /usr/class/cs348b/moonlight/bin/. To get a feel for the interface, work through the first tutorial (making a knot) provided in the tutorials section of the Moonlight website. You may wish to examine the other tutorials as well.
A few cautions: Moonlight seems to crash consistently if you use the "convert to triangles" feature and attempt to export to a RIB file. Also, importing from RIB files doesn't appear to work. You can, however, load and save the default Moonlight file format (.mlk), and export to RIB.
Using Moonlight (or another modeller), create a simple scene consisting of your name (using the "shapes->plain text" tool), and some simple geometry like a tube, quadric, or polyhedron. Be sure to put in a light source.
Export this scene as a RIB. Make sure it renders the way you want it to under lrt.
Create a "Homework 1" web page somewhere (for instance, under the WWW directory of your leland account). The page should list your answers to the lrt review questions from step 3, and provide a link to your rendered .tif image from step 5. Mail the URL to firstname.lastname@example.org.
Copyright © 2002 Pat Hanrahan