Sherwin Tam Math 198 May 9, 1996 Readme on illiJoe Here's the details about you new toy, illiJoe: History: originally, illiJoe was intended to be my foray into studies on human movement. however, since it took me so long to learn OpenGL, I wasn't able to actually make illiJoe move on his own. The program ends up as sort of a digital version of a G.I. Joe figure (hence the name illiJoe). To compensate, I studied a bit on lighting and was able to add a movable light source. illiJoe vs. G.I. Joe: Cons: Cleanliness: illiJoe sometimes has a nasty habit of relieving himself after you are done playing with him. I'm not sure if I have found the problem in the latest version, so for now assume that illiJoe will dump the core after the program is done, so you have to delete the offending mess. Durability: While I did try to impose joint constraints, the system is not perfect. Because of the way the movement is set up, it is still possible to generate some very strange positions. the second rotation about the z-axis is dependent upon the first rotation, so constraints that were fine when the arm was at rest are not so fine once the arm is raised 180 degrees. Then again, you could contort a G.I. Joe figure into weird configurations, so that's not so bad. A more pressing issue is that illiJoe has some suicidal tendencies. If given free rein, he _will_ attempt to stick his hand in his chest, his leg through his foot, or other embarrassing and potentially fatal positions. This is because there is no collision detection in the program; I really had no idea how to implement the feature, and decided it wasn't important enough to intensely study. Thus, there is no true illusion of solidity; then again, it was never intended to be anything other than a program. Ease of movement: I tried implementing movement in response to the mouse, but in OpenGL it is truly a pain, so instead illiJoe ended up being controlled by the arrow keys. This puts limits on the amount of movement. I could have used two extra keys for the third axis, but most of the limbs do not need a third dimension, so I kept the movement in two axes. However, that means that certain parts, namely the head, camera, and light source, do not have the full range of movement. Also. since the second rotation is dependent upon the first, the controls become counterintuitive when the limbs are fully rotated, i.e. the left and right keys do not seem to make as much sense moving the lower arm once the upper arm has been rotated through 90 or so degrees. Finally, you will notice that the lower torso cannot be selected. Moving the lower torso would involve double calculations involving the waist, and since the camera can be moved to rotate the entire body, I did not feel this was necessary. Lack of detail: Obviously, since illiJoe doesn't have complex polygons and texture mapping, the level of detail cannot approach a G.I. Joe figure. Originally, illiJoe was created using ellipsoids for a more realistic look, but to improve speed I ditched the ellipsoids in favor of icosahedrons (20-sided polygons). Besides, he didn't need that much flab, anyway. Interaction: illiJoe remains, for now, an isolated figure. He cannot be taken and used to hit some other illiJoe, like real action figures. Variety: G.I. Joe figures come with different outfits and even different sexes. illiJoe comes with a green top, blue pants, and brown boots, and is decidedly androgynous (but I call him a male). Portability: illiJoe must remain on your SGI computer, and so cannot be taken to school (unless your school has an SGI, too). Pros: Durability: While illiJoe does have the collision problem, it is almost impossible to take him apart. This is due mainly to the fact that it doesn't exist in true three-dimensional space, but also because I took the time to add extra polygons at the joints so that there are no spaces in the figure no matter where the limbs move (theoretically). And since illiJoe is not accessorized, there are no plastic guns to break, no batteries to replace, and no helmets to lose. Also, once positioned, illiJoe will stay exactly where you tell him to. The joints will never loosen, so no limbs will swing out of place when you least expect it. Range of movement: illiJoe does have the advantage regarding the number of moving parts. Besides the upper and lower arms, upper and lower legs, and head, he also sports a movable waist, moving ankles and moving wrists. Also, a second dimension is added to head movement (along the x-axis as well as the y-axis found in G.I. Joe figures), the lower arms (side-to-side movement), and the lower legs (same). Ease of storage: illiJoe is easily stored away when you don't feel like playing anymore. Simply exit the program by pushing escape (and remember to clean up, as above). In contrast, a G.I. Joe figure must take up precious shelf space somewhere, and can be lost under the bed somwhere, whereas illiJoe stays safely on your computer. Price: you can't beat illiJoe's price: it's free! In fact, you can copy him and have as many illiJoes as you want. No more paying for your action figures; you can have illiJoe whenever you want him. Lighting: lastly, what puts illiJoe over the edge, IMHO, is the inclusion of his own dramatic lighting. a local light source is ever-present and movable, so that you can have back-lighting, overhead lights, whatever you want for your play session without annoying anyone else while trying to dim the lights for that perfect mood. Use: illiJoe comes configured so that the arrow buttons will move the selected limb, as well as the camera and light. To select the different parts of illiJoe, use the number keys. They are as follows: 1 - upper torso 2 - head 3 - upper arms 4 - lower arms 5 - hands 6 - upper legs 7 - lower legs 8 - feet 9 - camera 0 - light To select a different side for the extremities, double-tap the appropriate button. The selected item should be highlighted in a red glow, unless the camera or light is selected. When you are done with the program, press escape to exit. Process: A quick overview of how the program works: The program will first initialize and open a window (1280-1024), and then adjust the projection and modleview matrices to the current window settings. It will then initialize the variables, setting the initial positions to 0 and the appropriate limits. The current (starting) body part to be moved is set to the upper torso. The lighting effects are then initialized, enabling lighting and defining the type of light, the type of shading, and so on. Then, all the keystrokes are assigned corresponding functions that are invoked when the key is pressed. Note that auxKeyFunc() is configured so that the screen is automatically updated once it is called. Then the two display loops are called. Both call the function display(). In function display(), the color and depth buffers are first cleared. Then the camera is translated back from the origin (makes defining points easier). The main part of the program, draw_frame() is then called. draw_frame() handles all of the actual drawing of shapes on the screen. It first positions the light source (to keep it independent of the camera), then rotates the camera. After that it draws the heirarchy of body shapes: first it draw the upper torso, then the head relative to the torso, then the left upper arm relative to the torso, then the left lower arm relative to the upper arm, then the hand relative to the lower arm. It then does the same for the right arm sections. Then the lower torso is drawn, then the left leg heirarchy, and finally the right leg herirarchy. display() then calls glFlush() to prevent waiting and start all executions, swaps the front and back buffers, and calls glFinish() to force the computer to complete all operations before the next frame. Extensions: The most obvious extension is to configure illiJoe for his original purpose, that of simulating accurate human movement. To that effect, the movement system must be modified, and collision detection between limbs must be added. Then, an algorithm could be made, perhaps, that would specify a point, and then have selected body parts attempt to realistically reach that point, i.e. if the arm was selected, the arm would move toward the point, using all of the included joints. This algorithm can then be expanded to include the whole body. Then moving the body is reduced to specifying a set of points that different "contact points on the body, most likely the hands, feet, and head, will gravitate toward. Another idea that was suggested was that illiJoe could be used to experiment with texture mapping. Assuming that the shapes used for the body parts are refined, the movement and light source possibilities allow the texture mapping applied to any part of the body to be fully examined from many different positions and under lany lighting conditions. My favorite idea, however, is the modifications to the light source itself. More than one source could be specified, and one could play around with the colors and intensity of the light and study its effects. Also, an algorithm for shadows can be developed (since one notices that currently, shadows are not cast regardless of the position of the limbs or light source). The body and light(s) can then be moved to test out the algorithm and verify that it works.