Bring Your Own Medium to the Cave – Part Deux

CS237 Assignment #2

 

 

1. Dates

Out

Tues, 9/17

Due

Thurs, 9/19

 

2. Goals

  1. Get started on realizing one of your own designs in the Cave.
  2. Start working in collaborative teams.
  3. Learn how to modify Cave program parameters with a “glueconfig” file.

3. Assignment

This assignment builds completely on the first one.  Now, working in groups of two, pick one of your virtual world designs from the previous assignment or a combination of the two, and work on creating that environment in the Cave.  You are given a version of the CavePainting program that allows you to import, resize, and position your 2D imagery within the Cave.  (See the Resources section below for details.)  And, of course, it allows you to create the usual CavePainting strokes.  This is all you need to do, so there is no programming involved in this assignment.  You should save your world in CavePainting (.cps) format when you’re done so that you can display it in the Cave for the class on Thursday.  Instructions on how to import and position pictures in space and how to save and load paintings using CavePainting are provided below.  Remember, you can also get to this information by typing “less $G/shared/man/cavepainting.txt” from one of the machines in the Cave.

4. Resources

4.1 Getting the Assignment Files

Before starting this assignment, you should logon to any Cave computer.  Then, open up a terminal window and at the prompt type, “cs237-setup-asgn2”.  This will create a courses/cs237/asgn2 directory in your home directory and copy a few files into that directory for you.  Next, change directories to get into the asgn2 directory.  (By the way, a directory is exactly the same as a “folder” on windows or mac systems.)  To change directories to your asgn2 directory, type “cd course/cs237/asgn2”.  Then, to see the files in this directory, list them by typing “ls”.  You will see 3 image files, these end in .rgb.  There is also a file called glueconfig-asgn2.  This is the file you will need to edit in this assignment.

4.2 Starting the CavePainting Program with glueconfig-asgn2

Files named glueconfig-something contain settings for Cave programs.  You can change the default settings for a program by telling it to look in a glueconfig file.  You do this by typing the name of the glueconfig file at the end of the command that starts the program.  So, to start CavePainting with the options contained in glueconfig-asgn2, type “cavepainting cave glueconfig-asgn2”. 

4.3 Modifying glueconfig-asgn2 to load your textures

For this assignment, you will be using the glueconfig-asgn2 file to tell CavePainting the names of the 2D images you want to load into the program.  To do this, you need to load glueconfig-asgn2 file up in a text editor.  For example, on the machine that you logged into (fish1, fish2, fish3), go to the asgn2 directory and type xemacs glueconfig.  You will notice the following lines in the glueconfig file.  These specify the names of the image files in your asgn2 directory.

 

#               Texture File Name               Name         Transparent

# -------------------------------------------------------------------------

LOAD_TEXTURES   hatch1.rgb                      hatch1          no \

                artery_wall.rgb                 artery_wall     yes \

                scan0001.rgb                    scan0001        no

 

You’ll need to change and add to these lines to load in your own images for this assignment.  LOAD_TEXTURES is the name of the configuration option you will be changing.  This is followed by a list of filenames, texture names, and whether this texture is transparent (whether it has an alpha channel).  Each image file name should refer to a file saved in your ~/courses/cs237/asgn2 directory.  For this assignment, make the name field the same as the filename field except without the .rgb extension. 

 

To use your own images rather than the example ones, replace hatch1.rgb with the name of your file.  You can keep adding additional lines with additional filenames as long as you want.  Remember to include a “\” at the end of each line!  CavePainting can only read .rgb, and .tga image file formats.  If your images are not already in this format, read “Getting you Image Files onto a Cave Computer” below to find out how to convert them.

4.4 Positioning 2D Images in the Cave using CavePainting

With the stylus held away from the wand, press the bottom stylus button to bring up the Texture Palette.  (Texture palette fades in..)  Point the stylus directly at one of the images in the texture palette.  The image will become selected when you get close to it.  (A box will show up around the image.)  Press the same (bottom) button on the stylus again to create a copy of this texture in the middle of the Cave room. 

 

Now, to move the image around, first select it.  Do this by holding down the 2nd button from the left on the wand and moving the wand on top of the image.  Again, a box will show up around the image to tell you that it has been selected.  Once it has been selected, hold down the 3rd button from the left on the wand and move the wand around to move the image to a new position.  Let go of that button when you get it where you want it.  To scale the image up or down, press the wand’s joystick up or down.  Each tap of the joystick will scale the image up or down by a percentage. 

4.5 Saving and Loading Paintings

To save a painting in CavePainting file format, press the “S” key on clio’s keyboard.  Remember that you need to get your mouse in that small “ButtonsKeyboard” window in the top left of clio’s monitor in order to have the program respond to keyboard presses.  If you have a really huge painting, the computer may appear to freeze for a few seconds while the file is created.  It will be saved in the file ~/course/cs237/asgn2/saved-painting.cps.  Every time you save a painting it goes to this same file, so it will overwrite any old painting stored under that name if you don’t rename it before saving again!  Be sure to rename your file by typing “mv saved-painting.cps asgn2-draft1.cps”.  Save often!!!  I have tested the program thoroughly, but it may not be 100% bug free and it may crash at some point.  If this happens you will loose your work if you haven’t saved it, so save often and remember to rename your previously saved painting to asgn2-draft.cps or something like that before saving again.

 

To load a painting that you have saved, edit the glueconfig-asgn2 file so that it contains the following line:

 

LOAD_PAINTING saved-painting.cps

 

Of course, replace saved-painting.cps with another filename if you have renamed your file. 

4.6 Getting your Image Files onto a Cave Computer

The easiest way to get images onto the Cave Computer is probably to save your images on a CD or a Zip disk (100 or 250 MB), let me know if you need to borrow one.. and bring them to the Cave, then follow these instructions to get them off one of the windows computers in the room and onto the network:  Put your disk into the windows machine.  That’s the one to the left of fish3 in the Cave room.  Start the SFTP program, there is an icon for it on the desktop.  Open a connection to clio.cascv.brown.edu with your username and password.  Copy the file(s) from your disk to your course/cs237/asgn2 directory using this program.

 

Your images need to be in .tga or .rgb format.  If they are not, you can convert them at the Cave using a program called gimp.  Gimp is a lot like photoshop.  Change directories to the place where you have your images stored (should be course/cs237/asgn2), then type “gimp imagefilename”.  Then right-click on the image and go to File->Save As.  At the bottom of the window that pops up, change the file name to have a .rgb extension.  For example, change image1.jpg to image1.rgb.  Press enter.  When it asks about Compression Type, select RLE Compression.

 

Note also that your images must be a certain size.  A good size is 512 pixels by 512 pixels.  They can actually be any of the following sizes (all in pixels): 2x2, 4x4, 16x16, 32x32, 64x64, 128x128, 256x256, 512x512, and 1024x1024.  In general, 512 by 512 is a good compromise between so big that it slows down the computer and so small that it looks blocky.

4.7 Scanning files in the Cave

Here are step by step instructions on how to use the scanner in the Cave from a linux machine (fish1,fish2,fish3) and get your image into CavePainting:

 

  1. Put your picture into the scanner - lift up the lid to do this.
  2. Start a terminal window on linux
  3. At the fish1 -> prompt type "netscape" and press enter
  4. If this is the first time you have started netscape, you will have to wait a while for it to start.  Then, it will pop up a few annoying messages, click Accept and OK until these go away.
  5. After netscape is running, find the location box where it says file://blah.blah.blah.  Double click on this text to highlight all of it, then delete it and enter http://hp237.cascv.brown.edu and press enter.  This will bring you to a webpage that controls the scanner.  You might want to bookmark this page in netscape.
  6. On the left of this page, click Scan.
  7. Then on the next page, click Scan Preview on the bottom right.
  8. Once the preview comes up, you can use the mouse to drag out a region that you want for the final scan.
  9. After selecting a region to scan, click on Download Scanned Image at the bottom left side of the screen.
  10. Wait a while for the scan to complete.  When it is done, netscape should automatically launch a picture viewing program called XV to show you the scanned picture.
  11. You can save the image to a file in XV, but it needs to be in a certain format in order to read it into the CavePainting program.  Continue following the instructions below to use XV to create a 512 x 512 .tga image.  Or if you know how to do this with another program, just save the file in XV and use your other program to do it.
  12. Drag out a square region of the image.  To do this, hold down the shift key and click and drag on the top left corner of the image.  Right now, the final image that you send to CavePainting must be square, if your image is not, then you will loose some of it or end up getting some white regions in addition to the image.  You might want to fill this region with black or make it transparent using photoshop, gimp, or XV - but if you don't already know how to do that, you should probably just ignore it for the purpose of this assignment and live with a little extra white border on one side of the image or a cropped version of it.
  13. After dragging out a square region, right click on the image to bringup the tools box.
  14. Press the Crop button near the bottom left of this window.
  15. Next go to the tools window again and click on the Image Size button, then select Set Size.
  16. Enter 512 x 512.
  17. Again, on the tools window, click Save.
  18. You will get a directory listing, if you have already run cs237-setup-asgn2 then, you will have a ~/course/cs237/asgn2 directory. Double click on the course folder, then the cs237 folder, then to asgn2 folder to get to that directory.
  19. As the file name, enter something.tga
  20. At the top right of the window, where it says Format, select Targa, also make sure Full Color is selected.
  21. Click OK or Save to save with these options.
  22. Follow the instructions in the asgn2 handout to edit the glueconfig-asgn2 file to include the name of your image file, run cavepainting, pop up the texture palette by pressing the 2nd button on the skinny blue tracker (the stylus).  You should see your image there.  Move the stylus over the image until it becomes selected.  Press the 1st stylus button to apply that texture to the brush, or press the 2nd stylus button to create a copy of the image in the world that you can position in space and resize..

4.8 Adding a Transparent Alpha Channel to an Image at the Cave

From a terminal window on fish1, fish2, or fish3, follow these instructions:

 

  1. Open the image with:  fish1 ~ -> gimp filename
  2. Right click on the image, choose Select -> By Color...
  3. Click in the image on the color you want to replace.  It will select with dotted lines all the regions of this color.  You can tweak it a bit with the Fuzziness Threshold.
  4. Click the Invert button on the By Color Selection window.
  5. Right click on the image, choose Edit -> Copy
  6. Right click on the image, choose File -> New...
  7. Check off Transparent in the Fill Type box at the bottom right of the New Image window.
  8. Click OK.
  9. Right click in the new image that pops up with a checkerboard pattern.
  10. Choose Edit -> Paste
  11. Right click on the new image, choose File -> Save
  12. Name the file something.rgb and make sure Determine File Type: By Extension is selected.
  13. Click OK.
  14. For compression type, RLE Compression should be selected.
  15. Click OK to save it.

4.9 Editing Text Files

You can create or edit files on the Cave computers by using a program called XEmacs.  Start it by typing “xemacs” at the prompt of the computer you logged into.  Don’t do this on clio because then it will display XEmacs in the Cave.  Rather, if you logged into the computer fish1, goto a terminal window that has a fish1 ~ ->   prompt and type “xemacs”.  You can use the File menu and buttons at the top the same way you would in Microsoft Word or any other word processing program.

4.10 Unix Cheat Sheet

The unix file system is setup with a hierarchy of directories, just like the folders you commonly see in Windows or Macintosh.  When you login with a terminal window you automatically go to your home directory.  This special directory is denoted by a “~”.  That’s why when you log into clio you get the clio ~ ->   prompt.  The ~ section of that denotes that the current folder that you are working in is your home directory.  In this assignment, some directories will be created for you when you run the cs237-setup-asgn2 command.  This will create a course directory inside your home directory and then a cs237 directory inside that and an asgn2 directory inside of that.  You change the current directory with the command “cd dir-name”.  So, when you’re logged into clio, type “cd course” and your prompt will change to clio ~/course ->.   You can list the files that are in the current directory with the command “ls”.  If you do that from within the course directory, you will see the directory cs237.  Try a “cd cs237  and then a “cd asgn2”. 

 

Unix Summary:

 

  1. Directories are the same as folders on Windows or Mac systems.
  2. In a terminal window, you are always working within a “current” directory.  The name of the current directory is shown in the prompt for example, in

clio ~/course ->,  course is the current directory.

  1. You start off in your home directory by default.  This is denoted by a ~.

 

Helpful Unix Commands:

 

cd name-of-directory

Change directories

ls

List all the files in the current directory

xemacs filename

Start a program to edit a file named filename

 5. Readings

  • Re-read Toolsmith II paper from class.
  • Read also: Kirby, et al, Visualizing multi-valued incompressible 2D flow using concepts from painting, http://www.cs.brown.edu/research/vis/lists/pdf/Kirby:1999:VMD.pdf .  Pick up what you can about how 2D flow works.  Forget the math -- look for whatever visual, geometric, or intuitive understanding you can glean about flow quantities
  • Look through the following in An Album Of Fluid Motion by van Dyke,: intro (p 6), plate under table of contents on pp 4-5, plates 23-27, 32-54, 59-62, 63-66, 69, 75-79, 85-87, 90-91, 92, 94-97, 99.  A copy of van Dyke will be available in the Cave.

 6. Questions

  1. What portions of your design changed once you started working with it in the Cave?
  2. What, if anything, surprised you about seeing your design in the Cave?
  3. Do you think your world achieves the feeling/mood you set out to achieve?  Does it convey the information you intended?
  4. What discussion question do you have from the Toolsmith II paper we read in class?
  5. List all the flow quantities displayed in Kirby, et al?
  6. What three flow-related words would you most like to understand?
  7. What is the most illustrative image from van Dyke?  Why?
  8. In this assignment, what worked, what didn’t work, and how would you change it? (briefly)

7. Checklist

o     Ran cs237-setup-asgn2

o     Changed directories to ~/course/cs237/asgn2

o     Modified the glueconfig-asgn2 file to load your own imagery

o     Positioned imagery in 3D

o     Cave-Painted additional 3D form

o     Saved the completed painting

o     Tested re-loading the painting

o     Answered and e-mailed assignment questions and checklist

 

8. Timing Estimates

            0:25 read and understand handout

            0:30 decide together on virtual environment and build strategy

            0:30 get images onto cave machine

            1:30 virtual environment run, tailor, and save

            0:45 read Kirby et al

            0:45 read van Dyke et al

            0:20 answer assignment questions