CS 325: Applied 3-D Graphics and Animation Lab One: Interface

advertisement
CS 325: Applied 3-D Graphics and Animation
Lab One: Interface Basics
Purpose
This activity will acquaint you with the Carrara interface and the use of numeric constraints
in positioning objects in a three dimensional scene. You will also see some examples of using
basic shaders and default rendering settings. Finally, you will see how three-dimensional data
is stored.
Objectives
When you are finished with this activity and subsequent practice, you should be able to
• launch Carrara and create a new empty scene;
• insert geometric primitives into the scene;
• position objects using numeric settings in the property window;
• name objects and select objects by name from the scene info window;
• examine a scene using multiple viewpoints’
• set the rotation of an object using numerical constraints;
• apply ready-made shaders to objects; and
• render the scene using default settings.
Tasks
****Note: When you launch Carrara, the default mode is “full screen,” meaning that you
can’t see any windows for other applications or any of the desktop. To hide Carrara (for
instance, so you can see this document) press “Command-H.” When you do this, Carrara will
put in the background and you’ll have to choose it from the dock to see it again. You can also
toggle Carrara in and out of full screen mode by clicking the small rectangular icon at the
upper right part of the Carrara window (between the eye and the x, as shown below).
Launch Carrara, and create a new empty scene document by: 1) selecting “New” from the
File menu; 2) clicking the radio button for “small scene” in the dialog box that appears; and
3) clicking “Empty Scene.” You will see a gray screen with a three-sided “box” composed of
grids. You are going to insert two simple geometric solids and manipulate them to learn a
little about the way the interface works.
A Literal Foundation: Putting a Floor in the Room
From the Insert menu, select “Infinite Plane.” The plane will appear as a light gray “floor” to
the box. At this point, save this document as “LabOneTest.”
Now take stock of the screen. At the top of the screen near the right hand side is a series of
icons that represent different phases of building and rendering a 3-D scene. The “room” you
are looking at is for assembling a scene and is denoted by a hand-shaped icon at the top of
the screen, toward the right side. If you hold the mouse over the other icons you will see tool
tips identifying the tasks associated with them.
The icons on the left side of the screen are tools for selecting and manipulating, and provide
different ways of moving around the scene (and moving the scene and objects within the
scene). The arrow is the selection tool, and you should generally make sure that this tool is
the one you are using if you aren’t trying to rearrange things.
You will notice many other icons on the screen. We’ll get to most of them eventually, and
you can explore more after finishing this activity.
If the infinite plane is selected, there will be three colored arrows radiating from its center. If
it is not selected, select it by clicking it on screen.
To the right of the assembly room are two windows for displaying properties of a selected
object and information about the scene under construction. The upper window shows
information about the currently selected object, including its name. You can give the plane a
custom name such as “TheFloor.” If a scene has many objects, naming them can make your
work easier. (You will notice that both windows have several tabs for accessing different
aspects of information about an object. The “General” and “Motion” tabs are the ones we’ll
use the most.)
Click the “Motion” tab in the top of this window and you will see information about the
coordinates of the object and its rotation around the x-, y- and z-axes. Enter the number 10 in
the box for Z Center (blue box in top row). You will see the plane move “up” in the room.
Now put a zero in this box to return the plane to its previous location. Entering numeric
values for coordinates is the most accurate means of positioning objects.
The lower window on the right lists (by name) every object in the scene, including lights and
cameras. It provides an alternate way of selecting objects that is more precise than pointing
and clicking on the screen. If you give an object a name, its name will appear in this list;
otherwise it will be identified with a generic descriptor. When a scene has many objects,
having good names makes selecting a specific piece much easier.
The amount of screen “real estate” allocated to these windows is adjustable using the narrow
blue “handles.” You can increase the amount of space available in the assembly room when
you need it.
The window at the bottom of the screen serves two purposes: a sequencer for controlling
animation and a browser for gaining access to existing work. We’ll look at the browser later.
Making Everything Square: Adding a Cube
Now insert a cube, using the Insert menu again. The cube will appear in the center of the
plane. If you look in the motions settings for the cube, you’ll see its size, scaling, and its
coordinates (0,0,2.5). Question—if the cube is five inches on a side, why is the z coordinate
only 2.5?
You will notice that the cube has three arrows—red, blue, and green—pointing out of its
center. These serve as “handles” for moving the selected object around the scene. Click/drag
on the blue arrow to move the cube up and down, and on the red and green arrows to move it
in the other two directions.
If you look on the left and right grids you will see on each a pale red or green box showing a
projection of the cube onto these planes. You can click and drag these to move the cube in
these dimensions (there is another such projection on the bottom grid, but you can’t use it
because the infinite plane is in the way). Try moving the cube around some using the
projections. (You may have some problems with accidentally “grabbing” the infinite plane
instead of the cube).
You can also manipulate objects by clicking and dragging them directly, but it’s not easy to
be sure which direction you’re moving them.
Now try moving it back to the center so that it rests on the plane, just using the handles and
projections. Are you sure it’s perfectly centered?
Getting a New Perspective on Things
Look along the right-hand side of the top of the 3-D view window. You’ll see a series of
rectangular icons:
vvvvvvvvvvvv
The first one is just a pale grey square, the next one is split by a horizontal line, the third
shows the top half split vertically, and the fourth is divided into quadrants. These icons let
you select how many views you have of the “assembly room.” Click the icon with four panes
and you’ll see the room from top, left, front, and from the camera angle (which is what
you’ve been seeing). You can get a better sense of how a scene looks by using multiple
views. By clicking in one of the four views, and then clicking the top-most icon (the plain
square) you can get a full screen view of that perspective.
Now, does it look like the cube is where it should be? Check by selecting the cube, and then
examining its motion settings in the property window. For the cube to be exactly centered, its
x and y coordinates should be zero, and its z coordinate should be 2.5. If the values are
anything else, you can enter the numbers to straighten things out. Once again, the numerical
constraints are the most precise way to position objects.
Getting the Picture: Rendering the Scene
So far, you are looking at a visualization of the scene designed to help in the modeling and
assembly process. Sharing the scene with others requires rendering it either as a movie or
still image. (When an architect draws how a building will look based on the blueprints, the
drawing is called a rendering).
To render your scene as it would appear from the viewpoint of the virtual camera, press
Command-R. This will take you to the rendering room and begin rendering using default
settings. Since this scene is very simple, rendering won’t take long, but complex scenes can
take hours to render. The result of rendering is a bitmap image.
Okay, the result is pretty dull. A grey plastic cube sitting on a grey plastic floor with sharp
shadows on one side. Let’s go back to the assembly room and try to make this scene less
pathetic by applying shaders to the objects.
Shaders mathematically alter the surface properties of objects, thus changing their
appearance. Once you are back in the assembly room (click the hand icon), choose the
Browser tab for the window under the modeling room (you might have to open this from the
bottom of the screen). After you have chosen the browser, you’ll see a set of smaller tabs
across the top of the browser window. Choose the Shaders tab, and then select Basic
Shaders. Look for a shader called checker. You apply a shader to an object by dragging the
shader to the object in the assembly window or by dragging the shader to the object’s name
in the instances list for the scene (located in the right tool drawer). Apply the checker shader
to the infinite plane, and find the shader wood to apply to the cube.
Now try rendering the scene again. The results should be at least a little more interesting.
One More Twist: Rotating Objects
In the real world, objects aren’t all aligned in a square grid, so if we want to be able to create
realistic scenes we need to be able to rotate objects in various directions. As you probably
have imagined, there are several ways to do this.
For quick-and-dirty rotation, we can use the rotate tool from the set of icons on the left side
of the assembly room. The rotate tool is an arrow curved in a circle, and when you use it to
select an object, a spherical “cage” of colored lines appears around the object. You can click
and drag the blue circle to rotate around the z axis, the green circle to rotate the object around
the y axis, and the red circle to rotate around the x axis.
The problem with using the rotate tool is that it isn’t very precise. One can use it to get an
object close to the desired rotation, but to finish the job, it is generally necessary to open the
motion panel and enter the exact degrees of rotation for the three axes in the provided boxes
(under the position boxes). Of course, you can just enter the numerical values from the start if
you know what they should be.
Try rearranging the cube in your scene using different types of rotation.
Combining Geometric Primitives
At this point you may be wondering what you can construct with geometric primitives that
doesn’t just look like building blocks. You can actually combine primitives to make fairly
interesting models. This example isn’t too fancy, but it should give you an idea.
Insert a cylinder into the scene. If it is embedded in the cube, move the cube to one side.
Insert a sphere.
Drag the sphere so that it is aligned with the cylinder in the x- and y-dimensions,
Now drag into in the z-dimension so that half of it is embedded in the cylinder.
You now have a bullet shape. Give some thought to other things you can model using two or
more primitive shapes.
File Types
You can save the rendered images. They are bitmaps, and can be used in any program that
reads bitmaps. So what’s the point of all the work? We can render the scene from any camera
angle, and see what it looks like from all sides. We’ll experiment with all of these factors in
greater length as the term progresses. Here is one last experiment to try before launching into
your own exploration.
Carrara allows us to compress a file when we save it. For the next part of this activity, you’ll
want to make sure the file is not compressed. Choose Save As, and after giving the file a
name and choosing a location to save it, a little dialog box like this one will open:
Make sure that the Compress File box is not checked, and finish saving. Now quit Carrara or
hide it. Launch Microsoft Word and open the Carrara file you just saved, and see what you
have.
In the bad ol’ days before good GUI interfaces, editing 3-D graphics meant dealing with files
that look like what’s in the MS Word window. (If you have trouble getting through this part,
you can find an example file on the class web site).
Isn’t it nice to live in the twenty-first century?
Summary
Have another look at the objectives from page one of this lab. If you aren’t sure how to do
something listed, go back over the lab to reinforce the information. What you learn from this
lab will be the foundation for everything that follows.
Download