CS184 Lab exercise 1 - due Friday 9/4/98

Notes on the lab:
To submit the lab, create a directory called lab1. Then put the main VRML file in a file called "lab1.wrl" in the
lab1 directory. Include any other files that lab1.wrl loads. To submit, cd to the lab1 directory and type "submit
lab1".

The HP machines now have a VRML browser called "vrwave". To invoke it, login to a HP machine and type
"vrwave". Unfortunately, the program often suffers from Bus errors when loading. Try setting xhost + or starting
and then stopping another memory intensive program (like Netscape) before you invoke vrwave. Eventually, it
should start.

To load the models used in lectures from an instructional machine, cd to the directory ~cs184/public_html. The
lectures and models are in directories names "lec2", "lec3" etc.

This first lab is an individual lab. You should do it and hand it in on your own. You will get instructions about the turnin program next week.

Preamble

Make sure you have card key access to the 349 Soda lab. Fill in the one or two forms handed out in class and return them to the front desk in Soda as early as possible on Friday 8/28.

Check your class account. Log in to one of the 349 machines and change your password.

The HP machines may not be available the week the lab is due. You are strongly encouraged to install the Cosmo plugin if you have a reasonably powerful PC, and to do this lab at home. You can get the plugin from SGI at http://www.cosmosoftware.com/download/index_player.html

Debugging VRML

VRML is an interpreted language and pretty easy to debug. The main thing is to set the Cosmo console to alert you when there is an error message. To do that, find "Preferences" on the right set of the screen, select it, and choose the "Advanced" tab. Check the box that says to open the console if there is an error. Then when you load a VRML file with an error, the console should come up and tell you the line and the name of the node where the error occurred. Sometimes it doesnt - if you load a file and nothing shows up on the screen, go to preferences->Advanced again and select "Display VRML console now".

VRML is case sensitive, and it is easy to get errors because of mis-typed node or field names. Make sure you understand the conventions: Node names always begin with a capital. Field names always begin with lower case. Multiple-word names have capitals at the start of each word after the first.

Part 1, building polygons

The first step is to create a set of polygons representing text. Choose two or three letters - your initials. Then sketch some polygons on paper that represent those letters. Figure out the point coordinates that will give the appearance you want. You can be creative with the fonts, but don't make too much work for yourself. (Don't use VRML's builtin text nodes of course). All the  points should lie in the Z=0 plane.

Now create a VRML file that contains those polygons. It should have a Shape node for each letter, so that you can adjust the letter colors separately. Use the IndexedFaceSet node to represent the geometry. Make sure you orient your loops counter-clockwise. You also need to set the non-convex option (see lecture 3) unless your letters are convex (most arent).

You should draw at least one polygon with a hole in it. If none of the letters you drew has a hole, make a square frame polygon like a picture frame that contains your initials.

Part 2, grouping and using DEF and USE

Take all the polygons you made above and make them the children of a single Group node. Use the DEF command to give this group a name.

Next you will make a series of transformed copies of the initials group. The transformed copies should be scaled by 0.2 in both X and Y. There should be a row of scaled copies of the initials above the original initials. We leave the number of copies up to you. It should be at least 3. Do this using translation only. Use the USE command to re-use the initials group that you named before.

There should also be a row of scaled copies of the initials group below the original letters. But these initials should be rotated by 180 degrees (don't forget that VRML uses radians). Use the same number of copies as you did in the first row.

Now create a column of scaled copies of the initials to the left of the originals. Those copies should be rotated counter-clockwise by 90 degrees.

Finally, create a column of scaled copies of the initials to the right of the originals. Those should be rotated clockwise by 90 degrees.