BLENDER is a three-dimensional modeling and rendering program. This means that you can use it interactively to construct 3D "worlds" and you can render images of the worlds you create. Blender uses OpenGL for rendering. It also uses OpenGL for drawing its user interface. The interface has to be called unusual. You should not expect to be able to start up Blender and figure out what to do with it! However, the interface is pretty usable once you get experienced with to it.
Blender can make animations, but we won't be doing anything with animation in this lab. It can also be used to create simple interactive games. However, we won't be doing anything interactive with Blender in this course. In general, there are many parts of the interface whose function you won't understand (and in many cases, I don't understand it either).
You can find a little gallery of images created with blender at http://www.elysiun.com/gallery.php.
Blender is installed on the computers in the lab, but there is no menu entry for it. You can find a "shortcut" to Blender on the "PCCommon" drive in the folder labeled "cpsc324." Double-click this shortcut to start Blender. (I have noticed a funny problem on the library computers: The mouse cursor can erase parts of menus that it passes over. I don't know any workaround for this.)
You can run Blender on the computers in the CS lab by giving the command blender on the command line. However it does not play well with KDE! If you want to use blender in our lab, you should log in to IceWM instead of to KDE. (Just change the pop-up menu on the login screen from "KDE" to "icewm".)
When blender starts, most of the screen is filled with a "World Window" that gives a view of a three-dimensional world. Below the World Window is a Button Window, which will be discussed below. The World can contain objects, lights, and cameras. The view also contains a grid that lies in the xy-plan and a "3D cursor." These are not part of the world, just part of the user interface. The picture at the right shows part of the world after some modifications. At the top is an object, shown in pink. At the bottom is a camera. The view has been rotated to show that the camera appears as a pyramid with an arrow to show which direction is the top of the camera. The 3D cursor is the other object, on the right side of the image.
The World Window shows you a two-dimensional projection of a three-dimensional world. You need to be able to change the view, to look at the world from a different viewpoint. This can be done using the mouse or using the keys on the numeric keypad. This table tells you how. Keyboard commands are sent to the currently selected window. To make sure they are sent to the World Window, click on the World Window.
|Changing the View with the Mouse|
|Drag with middle mouse button -- Rotate the view. (A rotated view might look cool, but it's not necessarily best for modeling.)|
|Hold down Shift, and drag with middle mouse button -- Translate the view (up, down, left, right).|
|Hold down Control, and drag with middle mouse button -- Zoom the view. Move mouse up to zoom in, down to zoom out. (Position of mouse affects zoom speed.)|
|Changing the View with the Keypad|
|Keypad 0||View from the camera.|
|Keypad 1||Default view (from "above"), along z-axis.|
|Keypad 3||View from "front", along y-axis.|
|Keypad 7||View from "side", along x-axis.|
|Keypad 2,4,6,8||Rotate the view.|
|Keypad +,-||Zoom in and out.|
|Keypad 5||Switches between "orthogonal" and "perspective" projection. (Orthogonal, the default, is generally best for modeling, but perspective is closer to what to you would actually see.)|
Changing the view does not modify the contents of the world. To do that, you have to add objects to the world. This is where the 3D cursor comes in. A newly added object is always added to the world at the position of the 3D cursor. You have to position the 3D cursor before adding the object. The 3D cursor is positioned by clicking, with the left mouse button, on the world window. The 3D cursor is positioned in three-dimensional space. You can't tell where it is by looking at the world from one point of view. Typically, you would check the position of the 3D cursor from several viewpoints by using the Keypad 1, 3, and 7 keys to switch between viewpoints.
Once you have the 3D cursor in position, use the "Add" menu to add an object to the world. Click on "Add" in the menu bar, then click on "Mesh" in the menu. This gives a sub-menu containing various mesh objects. ("Mesh" just means that it's made up of polygons.) Stick to mesh objects for now. The picture at the right shows the "Add" menu being used to add a "UVsphere." A UVsphere is a sphere divided by lines of latitude and longitude. A ICOsphere is divided into triangles. A Plane is actually just a rectangle. (When you first start Blender, the default world that you see contains a Plane as its only object.) A Tube is a cylinder without the top and bottom face filled in.
When adding certain types of objects, you will have to answer a question or two. For a Cylinder, for example, you have to specify the number of vertices. The image at the left shows the little dialog box that shows up when you use the Add/Mesh/Cylinder command. To accept the default value of 32, just press return or click OK. The button that says "Vertices: 32" is one of Blender's funny input buttons. I'll tell you later how to change the value on such a button. A Cylinder with six vertices, for example, would be an hexagonal prism.
After adding an object, you should immediately press the TAB key. Objects are added in "Edit Mode," which I will discuss below. Edit Mode is a little strange! The TAB key gets you out of Edit Mode.
Objects can be selected. When you apply an edit operation to the World Window, it affects the selected objects. In blender, you select an object by right-clicking it. Selected objects are shown in pink. You can select multiple objects by holding down the Shift key as you right-click the objects. When multiple objects are selected, certain operations only apply to the most recently selected object. This object is shown is a slightly brighter pink.
To delete selected objects, just hit the X key. You will be asked to confirm the deletion. You can delete the entire world, and return to the default world, with CONTROL-X. For these and all keyboard commands, the command is sent to the selected window. You can make sure that the World Window is selected by left-clicking it. (If that window not selected, the X key will be ignored.) Instead of the keyboard, you can use the "Delete" command in the "Edit" menu and the "New" command in the "File" menu. You'll see menu equivalents for many keyboard commands, but it's worth learning the keyboard.
(By the way, you can pop up a menu containing most of the menu commands by hitting the space bar. This positions the pop-up menu at the current mouse position, so it saves you the trouble of moving the mouse up to the menu bar.)
Blender uses some unusual buttons for numerical input, like the one shown above for inputting the number of vertices of a cylinder. These are actually pretty nice. They work like this:
You can translate objects (that is, move them around), you can scale objects (this is, change their sizes), and you can rotate objects. This is an essential part of modeling. To apply one of these operations to the selected object(s), use a combination of keyboard and mouse. Note that you do not simply click-and-drag an object to move it.
|Translation||Press the "G" key. (G stands for "grab".) Move the mouse without holding down any button. You can move the object in the plane of the screen only. Click with the left mouse button to finish. Click with the right mouse button to abort. If you click with the middle mouse button after starting the move, the motion will be constrained to vertical only or horizontal only. Clicking with the middle mouse button does not end the move. Alternatively, you can start moving an object if you right-click it and start dragging. However, releasing the right-mouse does not end the move! You still have to click with the left or right mouse button to end the move. There is a third way to start a move: Click the left mouse button and drag it a short distance in a straight line anywhere on the World Window. The selected object -- wherever it is -- is the one that will be dragged. The move operation begins when you release the left mouse button.|
|Scaling||Press the "S" key. Move the mouse towards or away from the object to change its size. The size changes in all three dimensions. Click with the left mouse button to finish. Click with the right mouse button to abort. If you click with the middle mouse button after starting the scaling operation, the object will be scaled in the vertical or horizontal direction only.|
|Rotation||Press the "R" key. Move the mouse to rotate the object around a line perpendicular to the screen. Click with the left mouse button to finish. Click with the right mouse button to abort. If you click with the middle mouse button after starting the scaling operation, you can rotate the object freely in three dimensions. An alternative way to start a rotation operation is to click the left mouse button and drag it in a circular arc anywhere on the World Window. The rotation operation starts when you release the mouse.|
It is also possible to input translation, scaling, and rotation factors numerically. To do this, hit the "N" key. ("N" stands for numeric input.) This pops up an input box with numeric buttons where you can set the values.
All these operations can be applied to the camera, just as they are applied to any other object. You can move and point the camera to get the view of the world that you want, when you render an image of your world.
Note that rotations and scaling are relative to the "center" of the object, which is shown as a tiny yellow or pink ball. This center point is not necessarily at the geometric center of the object.
You can get yourself real confused if you don't remember to press the left or right mouse button to end a transformation operation.
When an object is first added to the world, it is in "Edit Mode." You can put the selected object(s) into Edit Mode or exit from Edit Mode by pressing the TAB key.
In Edit Mode, the vertices of a mesh object are marked by tiny pink or yellow balls. Edit Mode is for editing the individual vertices of the object. In Edit Mode, you can select one vertex or a group of vertices. Selected vertices are shown in yellow. You can apply transformations to an individual vertex or a selected group of vertices, just as if they were objects. When you scale or rotate a group of vertices, only the vertices in the group are scaled or rotated. The object at right, for example, was made from a 6-sided cylinder by selecting the vertices at the top of cylinder and rotating them.
When a mesh object is first added (in Edit Mode), all of its vertices are selected. Pressing the "A" key will deselect all vertices. (If you press the "A" key when no vertices are selected, all the vertices will be selected.) You can select a vertex by right-clicking. Hold down the shift key while right-clicking to select multiple vertices. There is a way to add a group of vertices to the selection. Hit the "B" key. You can then draw a "box" by left-clicking and dragging with the mouse. Vertices within the box are added to the set of selected vertices. This is an easy way, for example, to select all the vertices at the top of cylinder. You might have to change the point of view several times while selecting the vertices and performing operations on them.
There are a lot of things you can't do in Edit Mode, so don't forget that you have to press the TAB key to get out of Edit Mode.
By the way, the "A" and "B" keys can also be used outside of Edit Mode for selecting sets of objects.
After you have created a model of your world, you want to render an image of it. But you won't see anything in the world unless there is light! To light your world, you have to add one or more lamps. You can add a lamp to the world using the "Lamp" command in the "Add" menu. The lamp appears at the position of the 3D cursor. You might have to add several lamps to properly light your scene.
By default, a lamp acts like a point source of light, and it does not cast shadows. It's possible to edit a lamp. You can turn it into a spotlight. Spotlights are capable of casting shadows. You can increase or decrease the lamp's brightness. You can change the color of the light. To do these things, you have to use the Button Window that is at the bottom of the screen.
The Button Window can show several different sets of buttons. The set that is displayed is controlled by the small buttons along the top of the window:
In this picture, I've clicked on the small Lamp icon. This makes the Button Window show buttons that are used for editing lamp properties. The window will only show buttons if a lamp is selected in the World Window. Otherwise, the Button window will be empty.
To edit a lamp, make sure that the lamp is selected, and click the little lamp icon at the top of the Button Window (or press F4). You'll see many editing controls. For now, let's look at a set of sliders located at the center of the Button Window, as shown to the right. Here, I've adjusted the top slider to increase the energy (that is, the brightness) of the lamp. The R, G, and B sliders control the color of the light. Here, I've decreased the value of B to give a slightly yellowish light. You can drag the slider to change its value. You can also shift-click on the left part of the slider button if you want to type in a value. Press return after typing the value.
Once you have some objects and lights in the world, you can see a rendered image by pressing the F12 key. This will open a new window to show the rendered image. Press F11 to dismiss this window! (The handling of this window is defective. The close box is not functional. If you don't dismiss it by pressing F11, then pressing F12 will not get it back. If the F12 key doesn't seem to work, try pressing F11 first, then press F12.)
The objects in the world will be an ugly gray unless you have applied materials to the objects. This is covered below.
The rendered image shows the world from the camera's viewpoint. Remember that you can get a preview of this view by pressing the Keypad-0 key. You can edit objects as usual in the Keypad-0 view, which can make it easier to arrange the objects in the image.
The default color of an object is gray. To change this, you have to add a "material" to the object. This is done using the material buttons of the Button Window. To see the material buttons, click on the small sphere icon, next to the lamp icon, at the top of the Button Window (or press F5). You also need to select the object, in the World Window, whose material you want to create or edit.
You won't see any buttons unless you have already added a material to an object. To add a material, you need to use a little button at the top of the Button Window that you would never notice if you stared at the screen for a week. It's a small button with a small white rectangle, as shown at the right. To add a material click (and hold) on this button. You will get a popup menu from which you can select a material. Initially, it will contain only "Add New," which can be used to create a new material. If you have already created some materials for objects in your world, those materials will be in the menu so that they can be reused for other objects. (Note: You might have to use this menu by click-and-hold, move to selected item in menu, and release. Just clicking-and-releasing might not work -- it might select one of the items in the menu.)
Once an object has a material, there will be lots of button in the Button Window that are used to edit the material. For now, look for the R, G, and B sliders just to the left of center. These can be used to change the color of the material.
A "texture" makes the color of an object vary from point to point. The colors could be copied from an image, effectively painting the image on the surface of the object. This is called an "image texture." Alternatively, the color can be computed algorithmicly from the coordinates of the point. This is called a "procedural texture."
In blender, a texture is part of a material. You can't add a texture to an object unless you have already added a material. The default gray material does not count.
To add a texture to an object, select the object. Then set the Button Window to show texture buttons. Do this by clicking on the small texture icon at the top of the Button Window, next to the materials icon (or press F6). If the object already has a texture, you will be able to edit it. Otherwise, use the Add button (with the small white rectangle) to add a texture to the object. A set of buttons will appear that can be used to select and edit the texture you want. For now, stick to the Clouds, Wood, and Marble textures. Click the "Clouds", "Wood", or "Marble" button to select one of these. When you do this, new buttons will appear that allow you to modify the appearance of the texture. The Marble pattern, for example, usually looks better if its set to "Sharp" or "Shaper" rather than "Soft."
The Clouds, Wood, and Marble textures make patterns of two colors. The funny thing is that both colors are set using the Material Buttons. The Texture Buttons set the pattern that the colors make, but not the colors themselves. So, to adjust the colors, go back to the Material Buttons by clicking the little sphere icon (or pressing F5). One of the colors for the texture is the basic material color, as set by the RGB sliders on the left side of the Material Buttons. The other colors is set by another set of RGB sliders that can be found on the right side of the Material Buttons. The default is an ugly magenta, so you probably want to change it.
In addition to the objects in the world, you can set certain global properties of the entire world. The image shown above, of a twisted six-sided cylinder, has "stars" and a "sky" that fades from dark blue to black. These properties are set using the World Buttons. To see the World Buttons, click the little world icon at the top of the Button Window. Then, use the Add menu (with the small white rectangle) to add a set of world properties to your world.
You will see two sets of RGB buttons on the left side of the World Buttons. These control the color of the bottom of the sky and of the top of the sky. You can get stars simply by clicking the Stars button to turn it on.
Working with files is my least favorite part of blender, but you have to know how to do it if you want to save your work. The "Save" and "Save As" commands in the "File" menu are used to save complete blender projects. This allows you to come back later, open the file, and continue work on the same project.
When you save or open a file, the World Window changes into a File Browser window. There are two lines at the top of the window that show the directory where the file is to be saved and the name that is to be given to the file. You can enter these by clicking and typing. Press return to finish typing a line. The image shows the directory and file names, just after I have typed the file name, before pressing return. To actually create the file, you have to press return again, or click the "Save File" button at the top-right of the window.
You can also browse the list of files to select the directory. Similarly for the file name, if you are opening a file or if you are saving and want to replace an existing file.
The "Save Image" command can save a rendered image in a variety of image formats. But before saving, you have to set the image size and format, and render the image. To set the size and format, you need to use the Display Buttons. Click the little scene icon at the top of the Button Window (or hit F10). Here is some of what you should see:
The button labeled "Jpeg" at the lower right of this image is a pop-up menu that is used to display the format of saved images. The default, Targa, should be changed to Jpeg for use on the Web. Just above that button are numeric buttons called SizeX and SizeY that are used to set the size of a rendered image. To the left (and not shown here) you'll find a few buttons that can be used to enter some predefined settings for the size. Clicking the Render button is equivalent to hitting F12. The button labeled "OSA" is a toggle button that can be either on or off. Here, it has been set to on. Turing OSA on will increase the quality of the image, at the expense of a little more rendering time.
Remember that to save an image, you should set up the Display Buttons, render the image, and then use the "Save Image" command to save the rendered image to a file. For Jpeg images, you should use a file name that ends with .jpg or .jpeg.
Mesh objects have a faceted appearance that is OK in some cases, but not necessarily appropriate for all objects. For example, you would probably like your spheres to be smooth rather than faceted.
To give a mesh object a smooth appearance, go to the Edit Buttons. (Click the icon at the top of the Button Window that looks like a square with yellow vertices, or hit F9.) Select the object you want to make smooth. Then click the "Set Smooth" button in the Button Window (at the bottom, left-of-center). The effect will only be visible in rendered images. You can undo the effect by clicking the "Set Solid" button.
These exercises are due next week. They should be posted on your web site, along with short comments (as usual). I will grade them on Thursday, September 26, at noon, or later.
Exercise 1: The file named stage.blend contains a blender project. It shows several objects on a stage, with spotlights and shadows. The stage is made from two Plane objects, scaled and rotated into place. The objects and stage are the default grey color. Add some colors and textures to the objects and stage to make a more attractive scene. Under Windows, you can find the file in the cpsc324 folder on the PCCommon drive. The easiest way to open it is to drag it onto the "Shortcut to Blender" icon in the same folder. There is also a copy of the file in the directory /home/cs324 under Linux. You can open it with the command blender /home/cs324/stage.blend. (The doughnut and heart in the scene were created as "Surfaces" rather than "Meshes," by the way.)
Exercise 2: Make an object similar to my twisted six-sided cylinder, and show it nicely displayed in a well-lighted world with stars. Use different textures and colors, but make a twisted six-sided cylinder. Here's my image again (but I've cheated by setting up a yellowish spotlight with "halo" effect turned on -- the halo makes the yellow glow):
Exercises 3 and 4: Make two additional images with blender. Try to make at least one of them look like something real. For example, make a snowman (with a top hat).