From panderso@cs.utah.edu Thu Jun 6 14:40:45 2002 Return-Path: Received: from cascade.cs.utah.edu (cascade.cs.utah.edu [155.99.209.37]) by wrath.cs.utah.edu (8.11.6/8.11.6) with ESMTP id g56KeiL16162 for ; Thu, 6 Jun 2002 14:40:45 -0600 (MDT) Received: by cascade.cs.utah.edu (Postfix, from userid 2879) id D7974EFA2; Thu, 6 Jun 2002 14:40:44 -0600 (MDT) To: dejohnso@cs.utah.edu Message-Id: <20020606204044.D7974EFA2@cascade.cs.utah.edu> Date: Thu, 6 Jun 2002 14:40:44 -0600 (MDT) From: panderso@cs.utah.edu (Philip Anderson) Status: RO This document explains how to use intro.scl to generate an alpha_1 model and to make an image. In general, the first step is to open emacs and open a buffer as an .scl file named whatever you choose. In this case, we're using intro.scl (if you haven't opened it alread, do so). Select a line of code (that doesn't start with "#") and type META-E. Your emacs window should be split in two. We'll be doing most of the coding in the top half. The interactions will be shown in the bottom. Go to your xterm window and type "tk3d" and then hit enter. In the end, this code will generate a three-dimensional smily head. We'll go through the code so that you understand the concepts presented. The face is mostly overlapping spheres, so it'll be pretty basic. All the lines that you encounter with the "#" symbol in front of them are comments. They will not be compiled. If you tried to META-E a commented code, then that's why your e-macs didn't split. Comments are especially useful because as your models progress, they will become a lot more complex. Trust me, pouring through hundreds of lines of code trying to figure out what line does what is not fun. When you're creating a shape, such as a sphere, begin with the name you wish it to be called, followed by a colon. I called my first object "HeadShape" so I typed "HeadShape:". Next comes the type of object you wish your object to be and the parameters involved in making it. The website "http://www.cs.utah.edu/gdc/projects/alpha1/help/man/html/shape_edit/shape_edit.html" is a tutorial of all the objects you can make and the operations you can perform. In this case we see that to make a sphere we need a center point and a radius. In the case of "HeadShape" I used a predefined point "Origin", but you can make your own points, too. In fact, you'll see an example of that a few lines down in the Intro code. Now that we've created an object, we should show it in the tk3d window. To do that we type "show(YourObjectName);" where YourObjectName is what you want to show. Thus, we have "show(HeadShape);". A sphere should appear in your tk3d window. If you don't want to see the object anymore, then just replace "show(HeadShape);" with "unshow(HeadShape);". Everything except for the mouth, the ears, and the hair in this model are spheres. We've just changed their sizes and positions. Type META-E on all of the lines of code to create and display them. Please notice the code for the hair. Instead of defining 21 new vectors and positions for each new strand, we defined one one strand of hair and then used the objTransform command to rotate it along the Z and Y axis, making new strands as it goes. This method is a lot easier and faster. Instead of calculating the new positions for each hair, we can cut and paste code! Then you just have to substitute names. For the full effect of this drawing you need to change some viewing settings. Nothing major. Go to your tk3d window, click on the View menu, and select Select All. Then go to Options, Curve and Surface Properties. Unclick Surface Isolines, and then Click on Surface Shading. Click OK. The image will appear solidly. This viewing mode isn't the best for while you drawing the object, because you will probably want to see what's going on inside the bigger object so you can place things, but for finishing touches, it's great. To make an object look more real, you can add colors(red, blue, yellow, etc), textures(grass, sky, bricks, etc), and surface qualities(shiny, dull, etc). You do that with setColor, setTexture, and setSq respectively. You can make your own colors using color(redvalue, greenvalue, bluevalue); where redvalue, greenvalue, and bluevalue are all numbers 1-255. That's what I have done. There are also preset colors. They're listed in the tutorial. Now you can probably make your own pictures and objects based on what you've learned here and what you see in the tutorial. The general format for creating objects is all the same (except for the parameters that you pass in). To make a finished product, however, you need to do more. You need light sources and a certain view (how you're looking at it in tk3d) so that you can render the object.