Kurt Schwehr Copyright (C) 2003 kdschwehr _at_ ucsd dot edu Viz Lecture Series Lecture 1 BACK TO BASICS $Revision: 361 $ CONTENTS * INTRO * WORKING WITH THE SGI VIA A MAC * WORKING WITH THE SGI VIA MS WINDOWS / CYGWIN * THINKING ABOUT THE SIO VIZ COMPETITION * FINDING OUT ABOUT THE DISPLAY * WHAT KIND OF SGI AM I USING? * OGLSNOOP/XMAG * SNAPSHOT * XV * IMGVIEW * TOOLCHEST * BUTTONFLY * MORE SGI INFO (insight) * CHOICE OF 3D * OPENINVENTOR TUTORIAL * CEDIT - PICKING COLORS ---------------------------------------------------------------------- * INTRO This lecture series will happen whenever I get around to writing the next lecture. There will be no fixed schedule. I will be attempting to show you how to do various visualization techniques using SGI IRIX workstations and Mac OS X. A good portion can be applied to other architectures, but it will be up to you to figure out what translates and how to do it. These lectures assume some basic level of Unix proficiency. That you can login, edit a file, write a program or script in your favorite language. If you need help with Unix skills try the O'Reilly series of books available in the UCSD bookstore (they have the animals on the covers) or a class here at Scripps or on upper campus. You will see me do any editing in "emacs". If you haven't already learned a Unix text editor, I highly recommend learning emacs. It's a little tough in the beginning, but is super powerful. * WORKING WITH THE SGI VIA A MAC The first step is being able to work with an SGI remotely across a network with a Mac on your desk or somewhere else on campus. This is easy to do and works with many (but not all) of the SGI applications. You will need to install Apple's X11 (X-Windows) server (currently Beta-3 version) and you will also want to install fink/fink commander. Here are some quick notes on how to do that. http://apple.com/ Go to "Software" Select "X11 for Mac OS X Public Beta v3" Click "Download SDK" (at the bottom right) --- This is needed by Fink Only then "Download X11" Install the developer tools/make sure they are installed Applications/Installers double click the devtools installer http://fink.sourceforge.net/ Downloads - binary installer Double click the fink 0.5.3 installer.pkg Use all the defaults Edit you .cshrc file... ask someone who knows Unix. Fink may do this for you. Put the following line in it... source /sw/bin/init.csh Install fink commander http://finkcommander.sourceforge.net/ Download the disk image Open the Fink Command disk and drag fink commander into applications Drag it from applications to your dock Run fink commander Install system-xfree86 (this is for apple X11) Allow access to unstable commands (they usually work fine!) Run fink commander Fink Commander -> preferences -> fink Check "Use unstable packages" and "Use unstable cryptography packages" Ok You then can install all sorts of great open source programs on your Mac really easily. -------- Now that you have installed an X server (X11), you a ready to log into one of the SGI's. The machines I know about at SIO are on the IGPP network: arad3d, redhot, and sioviz. Since these machines are used for research, make sure that you start all programs with "nice" so that you don't clobber people programs. From you Mac, open the applications folder, drag the "X" folder to your dock. Then double click it. A shell will pop up. Now use ssh to log into an SGI. Replace username with your user name (e.g. would be "schwehr" for me) and somesgi with the name of the computer you are logging into (e.g. arad3d). ssh username@somesgi.ucsd.edu enter "yes" if asked about an SSH key enter your password echo $DISPLAY You are now logged in. Your display should be something like "localhost:13.0" which means you are good to go. If not, you can do it this way, but this opens you up to being broken into (it is trivial to write a program that will watch everything that you type)... Before you log into the SGI (on your mac): xhost somesgi.ucsd.edu # NEVER use xhost + # If you do, you may find other peoples programs appearing on # your screen or worse ssh username@somesgi.ucsd.edu enter your password # for TCSH users (you don't use csh, do you????) setenv DISPLAY yourmac.ucsd.edu:0 # for BASH users... a much better shell than TCSH export DISPLAY=yourmac.ucsd.edu:0 * WORKING WITH THE SGI VIA MS WINDOWS / CYGWIN To those of you who have asked, you can use about 3/4 of this first lecture from a MS Windows PC, but being that I haven't done it, instructions are not included. It used to be that you had to by something like Exceed from Hummingbird, but now you can use this: http://www.cygwin.com/xfree/ * THINKING ABOUT THE SIO VIZ COMPETITION What would I like to see? Innovative use of the screen space. Use an old tool in a new way. Use a new tool. Do something related to your thesis. Maybe you can justify spending more time on making a great visualization. Take it with you to the next conference you attend. Don't be scared of static images! They can be pretty powerful on a 21 foot wide screen. Consider using both a laptop and the SGI. Wide range of tools/programs. If you know it or can learn it, why not use it. Mix and match for what you need and know how to use. Some programs that would be great to use: OpenInventor && xcore-ivview / Coin 3D / TGS Adobe Photoshop Adobe Illustrator Adobe Premiere Keynote Macromedia Flash MX Macromedia Director Matlab Mathematica FinalCutPro iDVD, iMovie sound... perhaps you study whale vocalizations? soundeditor sfplay Netscape, Safari, PHP, ASP, JavaScript, MySQL, Postgres You can do some amazing things with a web browser. GMT, Arc/Info, GRASS OpenDX Performer or OpenGL (for the hard core programmer) SDL The Quake Engine Java3D IVS Fledermaus POV (or any other ray tracer) Geowall SGI's Volumizer SGI's Shader Autocad or any other CAD system IRIS Explorer (http://www.nag.com/visualisation_graphics.asp) AVS (http://freshmeat.net/projects/avs/) Alias/WaveFront 3D Studio Max Vis5D Blender Go to http://freshmeat.net/ and search for visualization etc etc... ***** Have a range of backup plans. Things break, especially at demo time! If you have 3D fly throughs, make sure to make a quicktime video of at least part of a fly through. If you are using various interactive programs such as matlab, OpenDX, etc. make sure to take screen shots and have them ready in case the program will not run or load up your data. Put these images and a simple PowerPoint/Keynote of them on a CD or DVD. You can at least show that on a laptop. Be sure to test your demo before the day of the competition. Know how long it takes to start up programs and load your data. You only have a few minutes for your presentation. Please do not have long command lines that you have to type. It is very hard to type commands on the screen with everyone watching! Either use buttonfly, toolchest, or make some shell aliases so your programs are run by typing: "one", "two", etc. The first two are discussed below. To make aliases edit your .bashrc or .cshrc files and add: # Bash alias one="cd ~/somedir; run my first demo" # Tcsh alias one "cd ~/somedir; run my first demo" * FINDING OUT ABOUT THE DISPLAY As you move from computer to computer, you may want to know the size of screen in pixels and if you are in 24 bit (true color) or fugly 8 bit (color map flash hell) mode. Here is an easy way to find out: xdpyinfo | egrep -i "dimension|depths|class" | head Note that if you are logged into an SGI from a Mac, this will give you the size of your mac's display. Here is an example output: dimensions: 1280x854 pixels (433x289 millimeters) depths (7): 24, 8, 1, 4, 15, 16, 32 class: TrueColor Also note that for the SGI in the viz center that a portion of the bottom is off of the actual display. You can draw to it, but nobody can see what is down there. Here is a portion of xdpyinfo on SIO Viz: vendor string: Silicon Graphics bitmap unit, bit order, padding: 32, MSBFirst, 32 number of supported pixmap formats: 9 supported pixmap formats: depth 8, bits_per_pixel 8, scanline_pad 32 depth 16, bits_per_pixel 16, scanline_pad 32 depth 24, bits_per_pixel 32, scanline_pad 32 depth 30, bits_per_pixel 32, scanline_pad 32 screen #0: dimensions: 3200x1200 pixels (340x270 millimeters) resolution: 239x113 dots per inch depths (9): 1, 2, 4, 8, 12, 15, 16, 24, 30 Do not believe everything that is says. Check the dimensions and see if that matches 21x8 feet! * WHAT KIND OF SGI AM I USING? So you would like to know what kind of hardware this SGI has. Does it have a sound card? Is it an Octane, SGI Indi, O2, Onyx, Origin, etc. hinv This is the hardware inventory command. For an example, here is arad3d: hinv | egrep -i "processor|memory|graphics|audio" 2 300 MHZ IP30 Processors CPU: MIPS R12000 Processor Chip Revision: 2.3 Main memory size: 512 Mbytes Graphics board: SI with texture option Graphics board: SI Iris Audio Processor: version RAD revision 12.0, number 1 This says that this is an Octane SI with two video cards and 2 CPUs. However, we can not display nice 3D graphics on the 2nd display since it does not have the texture option. How do I know? Magic :) * OGLSNOOP/XMAG This is a nice program that lets you zoom into parts of the screen on the SGI. It is similar to, but much better than xmag. To learn more: man xmag man oglsnoop To use them, simply type: oglsnoop xmag & * SNAPSHOT Snapshot is a good way to grab screen shots on an SGI. There are MANY other ways to do it, but the SGI graphics frequently confuse other programs and give you good psychedelic colors. Snapshot is not a user friendly program but it works. Use the left mouse button to drag a box on the screen. Do this twice, once for each corner. Then use the right mouse button to select a filename to write to. And again when you are ready to take a snapshot. Use "xv" to view your snapshots. Use "Alt+F4" to move the snapshot window. cd SomeDirectoryForSnapshots snapshot xv & Snapshot writes files in the native SGI RGB image file format. To convert to something else, do something like this: sgitopnm snap1.rgb | ppmtotiff > snap1.tif sgitopnm snap1.rgb | pnmtogif > snap1.gif * XV xv is the swiss army knife of the Unix image world. It reads many image file formats and can do lots of operations with those images. It can even be used to make a powerpoint like presentation (which I did for my qualifier). The easiest way to use it: xv ListOfImages & Ctrl-V (start the visual schnauzer), the click "Update" Right click your image to get a menu type "e" in the image to start the color editor Try saving your image as a gif and then reloading it in xv hit the space in the image to go to the next image hit the delete or backspace key in the image to go back one image type "q" in the image to quit xv You can also make simple movies from static images, change the boards, etc. Here is a sample xv command line for a "movie". cd ~schwehr/Planets/ xv -wloop -wait 5 -nodec -geom +25+25 *.rgb & * IMGVIEW imgview is SGI's high speed image viewer created using the ImageVision library. It is good for being able to quickly pan around large images. To see the list of image formats that it supports, type: imgformats to view an image: imgview ~schwehr/Planets/blueMars.rgb to do simple modifications to an image: cp ~schwehr/Planets/blueMars.rgb . imgworks blueMars.rgb * TOOLCHEST SGI has a tool to start programs from a "Start" menu or dock. This tool is called "toolchest" and usually sits in the top left corner of your SGI desktop. You can make your own tool chest and put it next to the SGI toolchest or you can add stuff to the SGI toolchest by creating a file "~/.auxchestrc". The one that SGI has as default is "/usr/lib/X11/system.chestrc". Here is a sample .auxchestrc file that you can use as a template: Menu My_Progs { "emacs" f.checkexec.sh "emacs" "xv" f.checkexec.sh "xv" "display" f.checkexec.sh "display" "fledermaus" f.checkexec.sh "fledermaus" "dmagic" f.checkexec.sh "dmagic" } Menu ToolChest { no-label f.separator "My Progs" f.menu My_Progs no-label f.separator "xv some pics" f.checkexec.sh "(cd ~schwehr/Planets; xv *.jpg)" } To test the above, you can do this: toolchest .auxchestrc Ctrl-C This will pop up a new toolchest on top of your old one. You can move it off with "Alt+F4". For more info: man toolchest * BUTTONFLY Buttonfly is the cheese ball 3D flip over buttons menu programs for demos. You will need to make an alias for button fly to work right from the command line: alias buttonfly='/usr/demos/Demo_Interfaces/Buttonfly/buttonfly' Then create a bunch of menus. main.menu # Main menu .backcolor. .45 .45 .69 .color. .54 .54 1.0 .highcolor. .56 .52 1.0 Earth & Moon echo "Loading the earth moon..." ivview ~schwehr/Planets/Earth/earthmoon.iv -name "Earth and Moon" & SubMenu1 .menu. submenu1.menu ------------ # Sub Menu 1 .backcolor. .45 .45 .69 .color. .54 .54 1.0 .highcolor. .56 .52 1.0 run xv xv & some other command xterm & ------------ For more info: man buttonfly * MORE SGI INFO SGI has lots of online books. They are available at http://www.sgi.com or on the actual SGI by running the following command: insight & * CHOICE OF 3D fledermouse, perf, opengl, openinventor, worldtoolkit, sdl, see the list in the "THINKING ABOUT THE SIO VIZ COMPETITION" section. There are two bizzillion 3D graphics systems out there, and they all have their strengths and weaknesses. My personal favorite it OpenInventor. It is on the SGI's by default, doesn't require programming skills, IT'S FREE, can be extremely fast, and looks nice. You will get to hear about Fledermaus from others at Scripps, so I will not cover it. For an OpenInventor example from my 2002 Viz Presentation, see: http://schwehr.org/xcore/ And download http://schwehr.org/xcore/EelXCoreDemo-1.0.tar.bz2 Here is how you would do that on the IGPP machines: cd ~ mkdir XCoreDemo && cd XCoreDemo ~schwehr/IRIX64-6.5/bin/wget http://schwehr.org/xcore/EelXCoreDemo-1.0.tar.bz2 bunzip2 EelXCoreDemo-1.0.tar.bz2 tar xf EelXCoreDemo-1.0.tar cd EelXCoreDemo-1.0 ivview 02pc/ALL.iv ivview core2-chirp.iv xcore-ivview 02pc/ALL.iv xcore-ivview core2-chirp.iv * OPENINVENTOR TUTORIAL So now for some simple examples: sphere.iv: #Inventor V2.0 ascii Sphere {} Now view it: ivview sphere.iv sphere2.iv: #Inventor V2.0 ascii Sphere {} Translation {translation 20 0 0} BaseColor {rgb [ 1 0.5 0] } Sphere {} sphere3.iv: #Inventor V2.0 ascii Sphere {} Separator { Translation {translation 20 0 0} BaseColor {rgb [ 1 0.5 0] } Sphere {} } Separator { Translation {translation 20 0 20} BaseColor {rgb [ 0 0.5 1] } Sphere {radius 2 } } lineset.iv: #Inventor V2.0 ascii File { name "sphere3.iv" } Separator { Coordinate3 { point [ 0 0 0, 10 0 0, 10 10 0, 0 10 0, ] } IndexedLineSet {coordIndex [ 0, 1, 2, 3, 0]} BaseColor {rgb [0 .5 1]} IndexedLineSet {coordIndex [ 0, 2]} BaseColor {rgb [1 .5 0]} IndexedLineSet {coordIndex [ 1, 3]} } OpenInventor is easiest to use on the SGI, but is available for Mac OS X, MS Windows, Solaris, etc. You can try using Coin re-implimentation of OpenInventor (http://www.coin3d.org/) or you can by the TGS Version of OpenInventor. * CEDIT - PICKING COLORS When you don't have photoshop around to give a good color for OpenInventor, you can use SGI's "cedit" program. Run it and drag the 3 sliders around to get the color you want. Then read off the colors in RGB mode and put them into your BaseColor node in OpenInventor. One hint is to switch to HSV mode with the right mouse button. It is a lot easier in HSV to figure out what color you want. Then right mouse back to RGB to get the numbers you need. Pretty simple. man cedit cedit