Friday, January 29, 2010

BGE Blender 2.49b Part 3

Discuss this video at Ira Krakow's Blender 3D Forum



The purpose of this video is to show some basic sensor and actuator behavior. We'll look at the Always, Touch, and Keyboards sensors. I'll show you some basic techniques for moving an object, how the movement interacts with gravity, how to bounce an object, and how to replace one object with another object. I used Blender 2.49b for the demo.

Setup:
We'll use the default cube. Go to Front View (NUM1), the best for the BGE because it shows the effect of gravity the best, as objects actually fall down in response to simulated gravity. Add a ground plane for the cube to bounce off of (Shift - Add - Mesh - Plane). Scale the plane 8 times (S - 8 - Enter). Move the plane down about 5 Blender Units. It doesn't really matter - you could have moved the cube up as well to get the same effect. Select the cube. Go to the Logic buttons (F4). Select Rigid Body from the Physics types dropdown. This turns on the Actor button as well, so that the cube becomes an actor, with the realistic Rigid Body physics applied, in the Game Engine.

Show:
1) The default sensor is the Always sensor. Click the Add buttons to add a Sensor, a Controller, and an Actuator, to the cube. Wire up the logic bricks, connecting the sensor to the controller and the controller to the actuator. Enter .10 in the LocX area. What this logic block is saying is that, each time the logic blocks are evaluated (the Always sensor - it's not strictly Always, it's when the logic is evaluated), the cube will be moved .10 Blender Units in the X direction. Press P to start the game. Note how the cube moves in the X direction (because of the logic brick), as well as down (because of the rigid body physics) until it touches the plane (which is an obstacle that prevents the cube from falling any further). For a while, the cube moves in the X direction on the plane, until eventually it falls off the plane. Press Esc to end the game.

2) How to make the cube bounce. Enter 0 in the Loc X area. Now enter .1 in the Loc Z area, the third location area. Press P to start the game. Now, on every evaluation of the logic, the cube goes upward in the Z direction .1 Blender unit. At the beginning this causes the cube to go up a bit. Eventually, however, gravity takes over, being more powerful than the displacement in the Z direction, and the cube bounces down, until it hits the plane. After that, the cube bounces up in the Z direction, then gravity takes over, in an infinite cycle. Press ESC to stop the game.

3) Perhaps you want the cube to start bouncing only when it touches the ground, allowing gravity to control the cube fully before it hits the ground. To do that, change the Always sensor to a Touch sensor. Press the P key with the cursor in the 3D window to start the game. Note that the bounce doesn't take place until the plane touches the ground.

4) How to make the go in the X direction. Set the LocZ parameter back to 0. Set the LinV, linear velocity, to 0.10. This makes the cube's speed, in the X direction, become .10 blender units, every time it touches the plane. The cube indeed goes into the X direction that way, but its motion is unrealistic because the cube seems to penetrate into the plane. Perhaps you can do better. Hint: a more realistic way is to use the Servo type of motion. Post your render at http://forum.irakrakow.com to show the cube moving more realistic, without going into the cube. Press ESC to end the game.

Now click the little Add button on the LinV row, at the right. What that does is add .10 Blender Units to the speed of the cube. It accelerates quickly along the X axis until it falls from the plane. Press Esc to end the game.

5) Here's an interesting effect. We can replace one mesh with another while the Game Engine runs. We'll use the Keyboard sensor to trigger this effect. We will replace the cube with Suzanne. Here's how it's done. Go to Level 2 by clicking on the second rectangle. Add Suzanne (Space - Add - Mesh - Monkey). Click back on Level 1. The Game Engine only shows the objects on Level 1. We'll substitute the cube with Suzanne when we hit the R key (for replace, I guess). First, change the Sensor to a Keyboard sensor by selecting Keyboard from the Sensor Type dropdown. Left click in the Key area. In the rectangle, where it says Press A Key, move the cursor. Then press the R key. Now the key area displays the letter R. Whatever happens will be triggered when the user presses the R key.

In the Actuator area, select Edit Object. Below is a popup menu which lets you select the type of object editing you want. Select Replace Mesh. In the Obj: field, enter Suzanne. Wire the sensor to the controller and the controller to the actuator. Run the game by moving the cursor into the 3D window and pressing the P key. Press the R key. Suzanne magically replaces the cube. This is a great technique if, say, you want, say, your Cinderella mesh to be replaced by a pumpkin, as in the story. Press Esc to end the game.

6) Now suppose you want the cube back. We can show and hide the details about the sensor and actuator by clicking on the little arrow at the right. This is useful when you want to show a lot of logic bricks in a small area. So click these arrows to hide the details about the sensor and actuator. Let's make the C key restore the cube back. To do that, we need another set of logic bricks. Click the Add buttons on the Sensor, Controllor, and Actuator tabs. Set the sensor type to Keyboard. Left click in the Key area. In the rectangle where it says Press a Key, press the C key. Now the key area displays the letter C.

In the Actuator area, select Edit Object. In the popup menu which lets you select the type of object editing you want, select Replace Mesh. In the Obj: field, enter Cube. Wire the sensor to the controller and the controller to the actuator. Run the game by moving the cursor into the 3D window and pressing the P key. Let the cube fall to the ground. Press the R key first, replacing the cube with the monkey. Press the C key next, replacing the monkey with te cube. Pretty neat...you can make objects appear and disappear.

One last thing I want to point out before my 10 minutes runs out. Don't worry. I'll show more stuff in the next part. It's a good idea to name your sensors something meaningful instead of Sensor and Sensor1, the default names. To do this, expand the details for each sensor. Name the first sensor Monkey. Then click the arrow to hide the details. Expand the details for the second sensor. Name the second sensor Cube. Now you can tell what each sensor does.

I hope this gives you a better idea of how to wire up logic bricks to do basic object movement, as well as how to replace one object with another under Game Engine control. Leave your comments at http://forum.irakrakow.com. Happy Blendering!

Tuesday, January 26, 2010

2.49b BGE (Animation) Part 2



The purpose of this video is to compare animation in Blender 3D modeling with animation in the Blender Game Engine. The animation results are different because the BGE uses a different physics engine, Bullet Physics, than the 3D animation engine. As you will see, because the default frame rates are different, animations generated in the BGE are faster (60 frames per second) than in Blender 3D (25 frames per second). I will show how to visualize animations in both, how to synchronize the animations between the BGE and Blender 3D, and the basic visualization settings in the BGE that will let you fine tune your game animations.

I am using Blender 2.49b because, as far as I can tell, this is the only Blender version where you don't need Python scripting to synchronize the animations. Versions before 2.49 required you to have a Python script to set the default frame rate in the BGE. Blender 2.50, Alpha 0, has not fully implemented BGE animation yet. In 2.50 alpha 0, you can run a game and show visualizations, but you can't do animations in Blender 3D and have them show up in the BGE, or vice versa. Both of these can be done in 2.49b. I'll show you how to do both and why it's a good idea to be able to move smoothly back and forth between Blender 3D and the Blender BGE. So 2.49b seems to be the way to go if you want to do animation with the Blender Game Engine.

By the way, I have not seen this type of discussion anywhere, either as a video, in documentation, or in a book. The closest is Tony Mullen's book Bounce, Tumble, and Splash, which is an excellent introduction to Blender physics libraries such as the fluid simulator, soft bodies, cloth, boids, particles, and so on. However, he uses an older Blender version which needs a Python hack to synchronize the animation speeds between Blender 3D and the Blender BGE. My conclusions are the result of pure experimentation. If you have any comments on this, please join my Blender 3D forum at http://forum.irakrakow.com, and comment on this video.

Here are the steps:

a) Setup: Go into Animation View by selecting it from the different views available. Go into Front View, the best view for the BGE because of the gravity simulation, by pressing Num1 or View Front from the menu. Start by deleting the default cube (Select, right click, then confirm with the Delete key), Add an icosphere (Add - Mesh - Icosphere), accepting the defaults. Add a plane (Space - Add - Mesh - Plane). Tilt the plane 45 degrees (R - 45 - Enter) to tilt it. This will make the icosphere fall off the plane when we press P to play the game in the Blender Game Engine.

b) Before running the BGE, we need to make the icosphere an Actor, with rigid body physics. The plane will be an obstacle for the sphere, which will react according to gravity by falling off the plane. Movement of the sphere down the plane is dependent on gravity and the calculations of the Bullet Physics engine, as well as the mass of the object and other things. Press the P key with the 3D cursor in the 3D window to run the game. Press Esc to stop the game.

c) We can generate IPO curves from running the game. Check the Record Game Physics to IPO check box. Press the P key to run the game. Note how the IPO curves are generated in the IPO Curve Editor.

d) Here's how to fine tune collisions in the game engine. Select the icosphere. Select Bounds, and then Sphere. Check the Show Physics Visualization menu item from the Game menu. The visualization shows the rectangular area which is the collision area of the plane, as well as the spherical area which is the collision boundary for the sphere. This is how you check for valid collisions in the game engine. Press the P key to run the game. Press Esc to stop the game.

e) Let's see how our animation runs in the 3D part of Blender. Run the animation with Alt-A. Note how the animation runs much slower. Why is this? This is because the 3D animation is at 25 frames per second. Go to Scene buttons and find the FPS indicator. The BGE runs at 60 frames per second. In the World buttons, and this is ONLY in 2.49, in the Mist/Stars/Physics panel, the Physics part refers to the Blender Game Engine. The dropdown shows Bullet, the default engine. There's also Servo Physics. We'll leave the engine at Bullet. The FPS is at 60. We can change it to 25. Then rerun the BGE by pressing the P key. Press the ESC key and new IPO curves are generated.

f) We can also change Gravity. The default is earth's gravity at 9.8. Let's decrease it to 2, simulating a planet with less gravity. Press the P key to rerun the BGE. Press ESC to end the game and generate new curves.

g) We'll change gravity back to earth, 9.8. We're going to clear out the IPO curves we created. Press the A key in the IPO Curve Editor to select all the curves. Press the Delete key and confirm the deletion.

Another way to generate IPOs, which bypasses actually running the game, is to press Ctrl-Alt-Shift-P with your objects in the position as if you were going to run a game. Go to Frame 1. Position the icosphere above the plane. Disable Record Game Physics to IPO in the Game Menu. Instead, press Ctrl-Alt-Shift-P. The Bullet Physics engine runs, generating the IPO curves. Press Alt-A. Change gravity to 16. Press Ctl-Alt-Shift-P. Then press Alt-A. We now have the IPOs for gravity in a bigger planet, like Jupiter.

h) Let's go the other way, from 3D to the Game engine. We'll create a simple animation in Blender 3D. First, get rid of the previous IPO curves by going to the IPO Curve Editor, pressing the A key to select all the curves, and pressing Delete. Set keyframes from 1 to 100. Start with the ball. Keyframe it at Frame 1 by pressing the I key and selecting LocRot. Go to Frame 100. Move it 5 or so Blender Units up. Keyframe it by pressing the I key and selecting LocRot. Press Alt-A. Now we have an animation in Blender 3D over 100 frames.

i) We can get the Game Engine to run this animation using Logic Bricks. Do the Always Sensor with the IPO actuator. Select the Play type. Connect the sensor to the controller and the controller to the actuator, as usual. Make the end frame the same as the end frame in the 3D engine. Then run the BGE, to show that the BGE can run the IPO curves created in the IPO Curve Editor.

I hope you now have a better idea of how animation works in Blender 3D as compared with the animation of the Blender Game Engine. They're totally separate, yet, with more understanding of how Bullet Physics and gravity work, they can work well together. I look forward to seeing your animations, both in the BGE and in 3D, on my Blender 3D forum at http://forum.irakrakow.com. And don't forget to subscribe to my videos as well. Happy Blendering!

Monday, January 18, 2010

BGE Blender 2.50 Part 1

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.

Download the blend file



This is the first in a series of tutorials on the Blender Game Engine (BGE) in Blender 2.5. The purpose of this tutorial is a quick tour of the BGE user interface in 2.5. If you have used the BGE in 2.4x, the process should be fairly familiar to you. Even if you have never used the BGE, after watching this tutorial you should be comfortable enough to experiment with creating more complicated games. I'm using Blender 2.5 Alpha 0, which you can download from blender.org.

So let's get started. We'll use the default cube, in the default scene. We're going to bounce the cube onto a plane, simulating the ground. To create the plane, press Shift-A, then Mesh, then Plane. Scale the plane 10 times (S - 10 - Enter). Position the plane so that its center is roughly at the center of the cube. Select the cube. Move the cube upwards, in the positive Z direction, about 5 blender units, by pressing the G key, then the Z key, then 5. Now the cube appears to be ready to be dropped.

Blender 2.5 contains a series of views that are designed for things you would commonly want to do. Click on the icon to the left of the Default text. You should see selections such as Animation, Compositing, Scripting, and so on. Select Game Logic. Let's do a litte tour of the Game Logic setup. At the upper left is the outliner. In addition to the Camera and the Lamp, we have the cube, which is the active object, and the plane, which is just called Mesh. To the right of the outliner is the 3D view, set to Top View to start. Let's change to front view and rotate the view a bit so that we can watch the cube drop. With the cursor inside the 3D view, press Num1, or from the View Menu select Num1, to go to Front View. I used the middle mouse button to give the view a bit of an angle from the Front View, so you can see the cube drop.

Blender's game engine uses the Bullet Physics library to simulate gravity, collisions, bouncing, and the physics of the game world. This is actually a different type of physics library than, say, the fluid simulator or soft bodies. One of the challenges of working with the game engine is getting used to the differences. Animation and texturing, as examples, work a bit differently in the BGE than in the 3D modeling part of Blender.

Having said that, to make the cube participate, so to speak, in the game, we need to select the cube and click on the Physics buttons (all the way to the right). Right now, the settings for the BGE are not available to us. It appears as if the 3D physics options, such as Fluid and Cloth, are what's available. To make the BGE settings active, change the the renderer from Blender Render to Blender Game. Now the Blender Game Physics options can be set. To make the cube do its thing in the game engine, change the Physics type to Rigid Body. Note that the Actor check box is checked automatically.

This is enough to make the cube participate in the game. As in 2.4x, with the cursor in the 3D window, press the P key to start the Game Engine. The cube falls onto the plane, and rolls over a bit. Press ESC to go back to the 3D view.

Another way to start the Game Engine is to click on the Camera icon, the first one on the left, in the Properties Window. The buttons here also changed when we changed the view from Blender Render (which shows the image and animation settings) to Blender Game. Now, there's a big Start button. We can press the Start button to start the game as well.

Now we're going to add some interactivity to the game. We'll push the cube to the edge of the plane by nudging it a bit, until eventually the cube falls off into oblivion. To do that, we'll work with the bottom middle window. We'll maximize this window by pressing Control - Down Arrow. Then we'll zoom, using the Num- key, until we can see the Sensor, Controllor, and Actuators button groups. There are 3 Add keys. Click each Add key to add a Sensor, a Controller, and an Actuator. Here's the deal. The Sensor looks for some type of activity, in this case it's going to look for a particular key to be pressed. The Controller can control the logic as to what happens when that key is pressed. The Actuator determines what exactly happens after the sensor and controller logic has been set.

Let's make it so that when the user presses the R key, the cube moves a bit in the X direction. To do that, click on the Always dropdown in the Sensor area. Note that there are all types of sensors. We're going to use the Keyboard sensor. Select Keyboard. Position the mouse at the Key area, and left click. The prompt Press A Key displays. Press the R key. Any key will do.

Now go to the Actuators area. In the first Loc area, enter 0.5. The idea is that when we press the R key, the cube will go .2 Blender Units in the X direction. If you had entered 0.2 in the second area the cube would go .2 Blender Units in the Y direction, and similarly 0.2 in the 3rd area would make the cube go .2 Blender Units in the Z direction. There are other things you could have made the cube do, such as add a force or rotate (torque).

Finally, we need to hook up the Sensor, Controller, and Actuator. Connect the right socket of the Sensor with the left socket of the Controller. Then connect the right socket of the Controller to the left sockete of the Actuator. Now, when the BGE detects the R keypress, the cube will go .2 Blender Units in the X direction.

Let's see if this is what happens. Press Control-down arrow to return this logic window back to its original position. Click the Start button. The cube does what it did before. Now I will press the R key a few times. The cube bounces up a bit because that's what the Bullet Physics calculation might think a cube resting on its point might do as well. Eventually, the cube falls off the plane and bounces into space.

Let's add some more interactivity. Add an icosphere next to the cube (Shift-A, Mesh, Icosphere), accepting the defaults. Position the icosphere under the cube, between the cube and the plane. Go to the Physics tab. Give it a Rigid Body physics preoperty. Let's make the icosphere go .2 Blender Units in the -Y direction when we press the Space Bar. Maximize the bottom middle window, the one with the Sensor, Controller, and Actuator tabs. Press the 3 Add buttons for Sensor, Controller, and Actuator. Select the Keyboard sensor. Move the cursor to the Key area and left click. When prompted to press a key, press the Space Bar.

Press the P key in the 3D window to start the game. If you positioned the icosphere underneath the cube, watch the cube hit the icosphere and then react as if it was affected by the collision. Depending on how large the plane is and how big the cube and icosphere are, you might get different effects. The cube and or the icosphere might fall off the plane. Pressing the space bar causes the icosphere to move.

I hope this gives you a start with using the Game Engine in Blender 2.5. Press the SUBSCRIBE button on Youtube to make sure you won't miss my future BGE and Blender tutorials. Happy Blendering!

Sunday, January 17, 2010

Free Blender Render Farms

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.



One of the most significant challenges for Blender users is that, when scenes become complex, with meshes containing many thousands, or even millions, of polygons, complicated physics, many texture and material channels, many render layer passes, all of which are animated, render times on even a powerful PC can become unacceptably high. These can stretch into even days or weeks. You might think that you would need a Pixar-size budget to get acceptable render times. In fact, it's possible to significantly reduce render times, I mean by factors of 10 or 100, for free. The answer is to use one of the free render farm options available. I believe that Blender, combined with using one of these render farm options, can help you to approach Pixar-like, or Avatar-like, quality videos with a fraction of Pixar's budget, or even with no budget at all. That's why I call Blender "Pixar on your laptop". I hope Pixar doesn't sue me for this slogan. My goal for this video is to show you how to either create your own render farm if you have some spare PCs hanging around, and you have a wireless Internet connection, or how you can use one of the free, open source, to grab the computer power you need.

First, here's a quick and dirty way to create a render farm with some spare PCs that you have networked. The only real requirement is that you have enabled file sharing on, say, a Public folder in your network. I don't know what operating system - Windows XP, Vista, System 7, Linux, Mac OS X, whatever - that you're working on, but I'll assume that you have some way to share files. Once you've done that, create the Blend file that you want to render. Press the Scene button (F10) and in the Output directory, enter the name of the shared folder (I entered /IRA-PC/Public just as an example). Then press the Touch and the No Overwrite buttons. What this does is allow any temporary files to stay around. Save the file. Then copy the Blend file to the Public folder, making sure the file is shareable. The last step is to go to each PC on your network, open up the blend file, and press the ANIM button. Each computer will then start up at the next unrendered frame, thus sharing the rendering load. Try it. Tell us your results by going to my blog for these tutorials, at http://blender3dvideos.blogspot.com, and adding a comment.

OK, now suppose you don't have spare PCs available and want to speed up your renders like the big guys. No problem. There are a number of free, open source, render options available. I'll show you two of them. The most commonly used one is FarmerJoe, which you can download at www.farmerjoe.info (Make sure you use the .info suffix.) I haven't installed it, but I did download the zip file. The install appears to be simple enough. Unzip the file, in Windows, run the exe file, and then run the Python script to schedule jobs. There's a Web app server to check the status of your job. Again, try it and tell us your results by adding a comment to my blog at http://blender3dvideos.blogspot.com. I'll post the full URL of the blog page on the Youtube notes to this video.

Another possibility is the University of California, Berkeley's BOINC project, which uses the spare computer cycles of PCs around the world, available for anyone to share. You can join the network, at http://boinc.berkeley.edu and trade your idle CPU cycles with other PCs. There's plenty of idle computer time to go around. Why not make use of it?

Maybe you have other ideas? If so, please share them by commenting, either on my blog at http://blender3dvideos.blogspot.com, or leave a comment on this video. If you liked this, remember to hit the Youtube Subcribe button so you won't miss any of my future Blender tutorials. Happy Blendering!

Friday, January 15, 2010

2.49 Armature Animation

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.

Download the blend file



The purpose of this video is to show how armature animation works in Blender 2.49b. Understanding how to move the bones in an armature is the key to being able to rig a character. We'll first create a basic skeleton-like armature. Then, I will show the difference between FK (Forward Kinematics) and IK (Inverse Kinematics). I like IK in particular because my initials are IK. It's also something we both have in common with the exquisitely unreadable German philosopher, Immanuel Kant.

Leaving the Categorical Imperative aside, we will create a simple hand wave cycle and introduce the Action Editor and the Non Linear Action Editor (NLA Editor), to give you an idea of how actions are defined and how they can be layered together to produce complex movement. We're concentrating on the armature only, how the skeleton moves, so to speak, not the object to be rigged. Once you have an armature, say, of a human, moving correctly, you can then rig it to a human-like object. This is the theory behind the ManCandy rig. I will discuss skinning, the process of associating an armature with a character, either 2 or 4 footed, or I guess any-other-number-of-footed creature, in another tutorial.

Steps:

1) Delete the default cube. We're going to create a primitive skeleton. Go to Animation view by selecting it from the View dropdown. Go to Front View (Num1). Add an armature (Space - Add - Armature). Scale the bone up 4 times (S - 4 - Enter). Look at the Outliner. Expand the Armature outline. Note that the Armature has one bone, called Bone.

Tab into Edit mode. A bone is a child object to the armature. A bone has three parts, the tip, the root, and the body. A bone can be selected in one of two ways. One way is to select the bone's body, which will also select the bone's tip and root. The other way is to right click on the body and shift right click on the root, which selects the body, which is between the tip and the root. Press W for the Specials menu. Select Subdivide Multi, with 4 cuts. So now we have 5 bones, which can function as a primitive spinal cord. Expanding the Armature display in the outliner shows that the bones are named Bone.001, Bone.002, Bone.003, and Bone.004, parented to Bone. You can also see the names in the 3D view by going to the Edit buttons (F9)and pressing the Names button. Press the Names button again to turn the names off.

2) Turn on X-Axis Mirror. This is a handy tool which lets you create mirrored bones on the X axis. When the bones are symmetrical, using X axis mirror means that you only need to create bones on one side. Mirrored bones are created on the other side. Normally, to simply add a bone, you press the E key, which extrudes the bone. However, with X-axis mirror turned on, you can add mirrored bones by pressing Shift-E. If X-Axis Mirror is turned off, Shift-E acts like the E key, just extruding one bone. we'll also mirror extrude 2 legs with Shift-E.

Here's how it works. We're going to create two primitive arm bones, on the left and the right, at the same time. With the tip of the 4th bone of the "spine" selected, press Shift-E. This creates two bones, on the left and the right, which can be scaled. Press Enter when the bones are at the desired size. Select the tip of the newly created bone on the right and press Shift-E again. This creates two more mirrored bones.

We can create mirrored legs. Select the root of the lowest bone of the armature. Press Shift-E to create two "legs". Then select the tip of the bone on the lower right. Press Shift-E to create two more bones, for the feet. I hope you get the idea. I'll leave it to you to create fingers and hands, but for now, we have the basic skeletal bone strucure.

Let's see how bones are named. From the Editing buttons, in the Armature panel, click on Names. Names shows you the names of the bones that were generated. An easy way to see how the bones are named is by using the Outliner. The original bone is called Bone. The spine bones were created with the suffix .001, .002, .003, when the big bone was subdivided. Mirrored bones, the ones created with Shift-E, have an additional _R and _L, depending on whether they are created on the left or the right. Look at the outliner. You can see that each leg is parented off the base bone, Bone. If you look at a detailed armature, such as the Mancandy rig, you'll see that the bones have meaningful names, like Left Arm, Right Pinky, and so on.

The outliner clearly shows parent-child relationships in the armature. This is important when we start posing the armature. Turn off names.

3) OK. Now we have a basic skeleton. Let's see how the bones move, in particular the difference between forward kinematics (FK) and Inverse Kinematics (IK). Blender has a special mode, called Pose Mode, allowing us to move bones so that the armature ends up in the position we want. We're going to create a simple arm wave, what Blender calls an Action. Blender has a special mode, called Pose Mode, for moving armature bones. We're at Frame 1. Select the two bones for the right arm (Right click on the arm, then Shift-Right click on the second bone). Press the I key. Select LocRot.

The curves don't appear in the IPO Curves editor, although they were created. The reason you don't see the curves is that you need to go to the Pose curves. Change the curve type from Object to Pose.

A handy feature in the timeline is the red button that automatically records keyframes as you move bones around. If you don't press it, you would need to remember which bones you moved as you keyframe. This way, Blender keyframes each move as you do it.

Now go to Frame 11 by pressing Up arrow or entering the number 11 in the current frame area. Select the arm bone and press the G key to move it up a bit. Then select the other arm bone and press the G key to move it up in a salute type position.

We've actually created half of the waving action. We'll complete it now. Switch the window from the IPO editor to the Action Editor. Note that there are 2 keyframed bones, Bone.003_L, and Bone.003_L.001. The diamonds indicate the keyframe. To complete the wave, select the two diamonds (they're yellow when selected and white when unselected), at Frame 1. Then press Shift-D to copy. Finally, drag the two diamonds to Frame 21. Drag the vertical green arrow and watch the wave. Press Control-DownArrow to maximize the Action Editor. Rename the action to Wave, from Action. Press Control-DownArrow to return the Action Editor to it's original position.

Let's see the difference between FK and IK. Select the right arm bone. Turn on the AutoIK button. Grab the arm and move it. Note how the whole skeleton, except for the legs, move. This is definitely not how an arm moves. It's actually more appropriate for a leg. IK actually does movement backwards, to the root of the skeleton. You can change how far back the IK calculates by disconnecting a bone. To show this, select the third bone, go into Edit Mode (Tab), and click the CON button, which disconnects this bone. Go back into Pose Mode. Select the arm again, and move it. Note that the movement stops at the disconnected bone. FK does movement forwards.

There's one last window to see, the NLA Editor. This lets us mix different types of actions. Change the window type to NLA Editor. You should see the Wave action. If you press the C key while the Wave action is highlighted, you're prompted to change the action to an NLA Strip. Press Enter. These strips can be combined (wave + walk + hip swivel + talk, and so on). A detailed explanation of the NLA Editor is the subject of a future tutorial.

So that's a brief look into the basics of animating an armature. I hope you enjoyed it. If you did, be sure to hit the Youtube Subscribe button so you won't miss any of my future tutorials. Happy Blendering!

Wednesday, January 13, 2010

2.50 Animation Part 2

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.

Download the Blend file



In my first animation video, I showed how to keyframe location, rotation, scale, and material color, as well as how to group keyframed properties into keying sets. I left you probably wondering how, considering that the IPO window has disappeared, you can change the curves by editing them as you could do in Version 2.4x. In this video, I will show you how this is done, and how, overall, the animation process is easier than before. We will also look at some properties that now can be keyframed, such as modifiers, as well as the new F-Curve system.

Steps:

1) Start with the default scene, with the default cube. Change to the Animation view. In the Animation view, there are a number of new windows, in addition to the 3D window. The three that specifically relate to animation are on the left part of the screen. At the top is the Dopsheet, which is the new name for the Action Editor. As before, pressing Ctrl-down arrow makes the window full screen. We'll be doing this a lot in this video, to see what's going on in a particular window. Pressing Control-down arrow again returns the window to its original size.

In the middle left part is the Graph Editor, which is the new version of the 2.4x IPO Editor. You can edit animation curves in the Graph Editor. The organization of the curves has been redone, with major enhancements which I'll point out as we go.

At the bottom right corner is the timeline, the window which has changed the least. As before, you can scrub the animation by dragging the vertical green arrow, and the VCR llke keys do roughly what they did before. As I mentioned in the 2.50 Animation Part 1 tutorial, you can now run the animation backwards.

Before we start, set the end frame of the animation to 50 frames by entering 50 in the End area of the Timeline.

We're going to insert a LocRotScale keyframe at Frame 1, to start the animation process. It works the same way. Position the cursor over the 3D window. Press the I key. Select LocRotScale. Let's see what happened. It looks like there were some curves added in the Graph Editor. Press Ctrl-Down Arrow to see what was added. We can't see what curves were added until we click on the left arrow, to expand the display.

Nine curves indeed were added, location, rotation, and scale, in the X, Y, and Z direction, as in 2.4x. The rotation curve has a new term - Euler - that wasn't there before. That's because rotation can be done in what's called Quaternions, as well as Eulers. For the time being, ignore this. Eulers are what we know as XYZ. We'll go into more detail about these curves after we actually animate the cube.

Press Control-Down Arrow to return the Graph Editor back to its original size.

Go to Frame 25. Press the G key and drag to move the cube over 4 or 5 Blender Units. Press Enter when done. Scale the cube up 2 times (S - 2 - Enter). Rotate the cube 45 degrees (R - 45 - Enter). Press the I key and insert an LoRotScale keyframe. Let's see what happened in the various graphs.

Start with the Graph Editor. Indeed, there are now 9 curves that we can see. They're all visible because all the check boxes at the left are checked. There's also an individual color assigned to each curve, such as red for the cube's X location. Let's in fact edit the curve for the cube's X location. To do that, uncheck all the boxes except for the X location curve. As before, each curve (they're now called F-curves) is a Bezier curve. You're in edit mode, with all the points, each representing a keyframe, selected. Press A to deselect all. Then right click on the ending keyframe. Move it up 2 Blender units or so by pressing the G key and moving it up. If you uncheck the Cube group and then check it again, all the curves display.

The lock icon controls whether or not a particular curve can be edited. If you click on it, the lock icon goes into the locked position and it can't be edited. If you click on it again, the curve is unlocked and can be edited.

Press Ctrl-Down Arrow to return the Graph Editor to its original location.

Press Alt-A to run the animation. The cube goes in the X direction, according to how you edited it.

The eye icon controls whether or not that particular curve contributes to the animation. It's a toggle. When the curve contributes to the animation, you see an eye. When it doesn't, the icon is greyed out. To show you how it works, click on all the eyes except the one associated with the X location curve. Press Control-Down Arrow to return the Graph Editor back to its original location. Press Alt-A or use the VCR keys to animate. Now the cube just moves in the X direction.

While we were animating, note that the Dopesheet, the graph at the top right part of the screen, was populated. Position the cursor over the Dopesheet and press Control-Down Arrow. These are actions that can be combined in the NLA editor. We won't discuss these in this video. I just wanted to point this out. There still seem to be some problems with screen refreshing of this window.

Let's see what happens when we animate another object. Let's add Suzanne to the scene (Shift-A, Add, Mesh, Monkey). Let's insert a LocRotScale keyframe for her. Press the I key, then select LocRotScale. Some more curves were added. Amazingly, we can edit the curves of both objects. What happened? First, Suzanne is now called "Mesh". There's an object called Mesh, as well as a mesh called "Mesh". As with the cube, the curves for what we used to know as Suzanne are in the Mesh's mesh. If you expand the Mesh Mesh, you'll see them. You can also view the Cube's curves.

Press Alt-Down Arrow to return the Graph Editor back to its original position.

The last thing I'll show in this video is that modifiers can be keyframed. This can make for amazing effects. Let's add an Array Modifier to the monkey. Set the current frame to 1. Then, click on the Modifier icon in the Mesh's Properties. Select Array. Change the count to 4. With the cursor on Count, in the Array Modifier area, right click. Select Insert Keyframe. Then go to Frame 25. Change the count to 2. With the cursor on Count, select Insert Keyframe. Press Alt-A to run the animation. Note how the number of monkeys changed.

Look at the Graph Editor. A new curve, called Count(Array) was created. There also is a Count(Array) curve created in the Dopesheet.

The goal is that any property you can see can be animated. Think of all the modifiers and all their properties that you can now animate easily.

Believe it or not, this only scratches the surface. I hope this tutorial gets you to think about how to use Blender 2.5's animation in your scenes. Don't forget to subscribe to my videos on Youtube so you won't miss any. Happy Blendering!

Monday, January 11, 2010

2.50 Animation Part 1

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.


Download the blend file


Watch mfoxdogg's Blender 2.50 Tour 9 Part 2 (Animation) video



This tutorial is based on the Blender 2.5 Tour 9 (Animation) video, published by Michael Fox, aka mfoxdogg. Michael works closely with the Blender developers and has detailed knowledge of all the new features in 2.5. At my blog, at http://blender3dvideos.blogspot.com, is a link to his animation tutorial, as well as to his blog at blenderlabrat.blogspot.com. He has been doing Blender 2.5 tours for a while now, as evidenced by the fact that this is Tour 9. What's nice is that Michael also frequently contributes comments to my videos as well. If you have 2.5 questions, just email him or post a response to his comment.

I won't go into nearly as much detail as Michael does. My goal for this video is to give you a basic understanding of how animation in 2.5 works, and how it differs from 2.4x animation. For one thing, animation is much easier in 2.5. For another, you can animate just about anything in 2.5. In 2.4x there were many features that you could not animate. The developers completely rewrote, and significantly improved, the animation code in 2.5.

So start up Blender 2.5. I'm using the Alpha 0 version, which you can download from blender.org. We'll start with the default cube. Just as in 2.4x, with the cursor in the 3D window, you can press the I key to insert a keyframe. You can insert combinations of location, rotation, and scale keyframes. At Frame 1, insert a LocRotScale to insert location, rotation, and scale keyframes. The timeline window is right below the 3D window.

Move the timeline slider to Frame 50. Move the cube 3 or 4 blender units to the right (Right click to select, G to grab, then drag, then press ENTER). Scale the cube up 3 times (S - 3 - Enter). Rotate the cube 45 degrees (R - 45 - Enter). Insert a LocRotScale keyframe (press the I key, then select LocRotScale). Set the animation end frame to 50 by entering 50 in the End area. Press Alt-A to animate. Note how the cube grows, moves, and rotates from Frame 1 to Frame 50. Press ESC to stop the animation.

Alt-Shift-A behaves a bit differently from Blender 2.4x. If you press Alt-Shift-A, the animation goes backwards, from Frame 50 back to Frame 1. You can see the backwards animation in the timeline, as the slider goes backwards. In 2.4x Alt-Shift-A pleys the animation forward in all windows. In the VCR controls in the timeline, you see two arrows, a left pointing arrow and a right pointing arrow. The left pointing arrow plays the animation backwards, and the right pointing arrow plays the animation forwards.

Just as in 2.4x, you can animate material properties, such as diffuse color. In 2.4x, you had to go to the material context and press I to insert a keyframe. In 2.50, the material properties are grouped together in the materials panel. Let's change the diffuse color from red at frame 1 to green at frame 25 and blue at frame 40. First, go to the materials panel by clickinig on the grey ball icon. Then go to Frame 1 by setting the current frame number. A basic goal of Blender 2.5 is that anything that you see can be keyframed. The way to do that is to right click on a property and then select Insert Keyframe. Click on the Diffuse Color rectangle. Change it to a reddish color by selecting it in the color wheel. Right click on the rectangle and choose Insert Keyframes. Keyframes are inserted for the Red, Green, Blue, and Alpha channels.

Now go to Frame 25 by setting the Current Frame slider. Click on the Diffuse Color rectangle. Change the color to a greenish color. Right click on the diffuse color rectangle. Select Insert Keyframes.

Go to Frame 40 by setting the Current Frame slider. Click on te Diffuse Color rectangle. Change the color to something blue like. Right click on the diffuse color rectangle. Select Insert Keyframes. Now press Alt-A. Now the cube grows, moves, rotates, and changes color, based on the keyframes you have set.

You can add bunch of properties at a time, including properties you could not set in 2.4x. You do this by defining a keying set. Here's how it's done. We're going to change a group of properties related to specularity, the little spot that's reflected from the lamp. To do this, go to Frame 1, in the usual way. Right click on the Specular color rectangle. Click on Add Single To Keying Set. Then right click on the Specular Shader. Click Add Single to Keying Set. Right click on Hardness. Click Add Single to Keyiing Set. We've now defined properties related to specularity that we can keyframe all at once. At Frame 1, change Specular color to magenta, Shader to Phong, and Hardness to 255.
Click the little Key icon next to the word ButtonKeyingSet. This keyframes all those specular properties. Go to Frame 33. Change Specular color to yellow, Shader to Blinn, and Hardness to 3. Click the Key Icon next to the word ButtonKeyingSet. Keyframes are added at that point. If you press Alt-A, you might not see all the changes, but if you created an actual video, you would see it.

At this point, if you have worked in 2.4x with animation, you might be wondering where all these curves are kept and whether you can edit them in the IPO window. Well, I have news for you. The IPO Curve Editor is gone. Now you're probably even more confused. The IPO Curve Editor has been replaced by the Graph Editor. These curves are, after all, graphs. The graphs are grouped in a way that you really can edit them easily. The curves are grouped into action oriented curves (the location, rotation, and scale curves), and the Materials oriented curves. The Button Keying Set, when expanded, shows the curves related to specularity, that we defined in the keying set. If you collapse the Button Keying Set, you see the diffuse color curves.

How can you edit just one curve? By clicking on the eye icon, you can hide (or show) a particular curve. You can hide or show all the curves in a keying set by clicking on its eye icon. If you click enough eyes, you can get down to the particular curve you want to edit. By the way, these curves are now called F-curves. These curves are Bezier curves, just as in 2.4x. I'll discuss the Graph Editor, as well as the other visual editors related to animation, in Part 2 of the 2.5 Animation Tutorial.

I hope this gives you a leg up on how animation has changed in Blender 2.5. If you want to play with the Blend file I created, go to my blog related to this tutorial, at blender3dvideos.blogspot.com. Also, don't forget to press the Subscribe button on Youtube so you can find out how this 2.5 animation story ends. Happy Blendering!

Friday, January 8, 2010

Animated Procedural Textures

Join my Blender 3D forum where you can network with other Blender friends and get your Blender 3D questions answered.

Download the blend file



My last tutorial demonstrated how to animate object location, using Insert Loc keyframes from the 3D window, manipulating curves in the IPO Curve Editor, as well as how to use IPO drivers and PyDrivers. You might get the idea that location, rotation, and scale are the only things you can animate. In fact, there are many other areas in which you can animate. In this tutorial, I will show how to animate a procedural texture to create a wavelike or moving cloud effect. This technique is based on the excellent series of tutorials by Colin Litster, at www.cogfilms.com. If you really want to create a realistic ocean effect, make clouds float by realistically, make a flag wave, and so on, you should check out all of Colin's tutorials. This techniques has become very popular in the Blender community. Colin been a driving force in the Blender community for a long time.

Blender's textures come in two forms, procedural and image. If you've worked with Blender for even a short time, you've probably encountered the Image texture, which is simply the projection of a 2D image into an object, such as a plane. Image textures are non-procedural. The image, what you see, is what you get. Procedural textures are really little programs that you can tweak to get a particular special effect. One of the most commonly used procedural texture is Clouds. We're going to animate the Clouds procedural texture, projected onto a colorless, shadeless plane, to produce a wavelike effect.

You can download the blend file that I created, that you can use in your own projects and share freely. You can find the link at my blog, http://blender3dvideos.blogspot.com, where you can also read the script for my tutorial, as well as the scripts for all the tutorials I've published.

So start with the default Blender scene. Delete the default cube (Right click to select, press the Delete key, then Enter to confirm). Add a plane (Space - Add - Mesh - Plene). Scale it 3 times (S - 3 - Enter). Orient the camera so that it faces the plane (View - Align View - Align Active Camera to View, or press Ctrl - Alt - Num 0). Scale the plane in the X and Y direction so that it fills out the outer dashed line rectangle. This will ensure that the camera sees the entire plane, without the background rendering.

Press the Shading button (F5) and use the default material (Material). Press F12 to render. The plane renders with the default gray color and the specular highlight. We're going to make the animated procedural texture control both the shape and the color of the rendered plane. To get rid of the specular highlight, click the Shadelees button. Press F12 to render. In the Map To panel, all the way at the right, make the color black.

Press F6 or click on the icon next to the ball to go to the Texture buttons. The first texture channel (channel 0, technically, we need to remember that), with the word Tex is selected. The texture we select will be mapped to that channel. There are 10 texture slots. We can blend all sorts of textures (images, clouds, blending types, and so on) using these slots. We'll use the default Channel 0. From the Texture Type dropdown, choose Clouds. You can control how the clouds look using the sliders and the various types of noise, such as soft noise or hard noise. Accept the defaults. You can play with these later to get the effect you want.

Press F12 to render. You get a sort of black and white wavy picture produced by the clouds texture. We are now going to animate this so that it looks like real waves. Split the 3D view. From the bottom border of the window, right click when you see the double arrows. Select Split Area. Move the cursor to where you want the view to be split. Press Enter. Then change the type of the newly created window at the right to IPO Curve Editor.

We're going to work with the IPO Curve Editor in full screen mode. To do that, position the cursor inside the editor area and press Control- Down Arrow. The IPO Type is set t Object by default. There are other types that can be set. Change the IPO Type to Material. Note on the right all the different things that can be changed - red, green, and blue channels, the alpha (for transparency), specularity, hardness, and so on.

We're going to change two offsets, the X offset (OfsX) and the Z offset (OfsZ). The X offset controls the track of the texture across the Z axis, making it seem to move across the window. The Z offset changes the shape of the cloud/wave texture. We'll animate this over 100 frames. Start with OfsX. Left click OfsX. Zoom the view using the Num+ and Num-, so that you can see the 1 and -1 values on the right. These represent the number of blender units to offset as the animation proceeds. At about Frame 1 (it's not necessary to be totally exact), with the value at -1, press Control-Left Click. A horizontal curve is created. Go to Frame 100 or so. Control-Left Click where the value is 1.
You now created a Bezier curve interpolated between those two values, for the 100 frames. To make the curve interpolate linearly, go to the Curve menu, then select Interpolation, then Linear. We can extrapolate this line both forward and backward in time by selecting Curve - Extend Mode - Extrapolation.

We'll do the opposite for OfsZ, going from 1 to -1. Shift-Left Click OfsZ at the right. At Frame 1, find the value of 1, and press Control-Left Click. Then go to Frame 100. Find the value of -1, and press Control-Left Click. Then go to the curve menu and change the interpolation to linear. Finally, from the Curve Menu, we'll change Extend Mode to Extrapolation. We now have our two curves created.

Press Control-Down Arrow to return the IPO Curves Editor back to its original position. We can't see the animation effect in the texture with Alt-A. We need to actually animate the scene. To do that, go to the Scene buttons by pressing F10. Change the end frame to 100. Select the Preview preset by pressing the Preview button, all the way at the right. Just for this demo, we'll animate this as a series of JPEGs. You can create a video out of this by selecting AVI or MOV format. So press the ANIM button to animate. Looks sort of wavy, doesn't it?

We can make it a bit more realistically water looking. To do that, select the Material buttons, go to the Map To panel, and change the color to something bluish. Press F10 to go back to the scene buttons. Then press ANIM.

That's it! You're now an animated procedural texture guru. You might also tweak the clouds setting, especially the noise type and amount, or try some of Blender's other procedural textures. If you liked this tutorial, be sure to hit the Youtube SUBSCRIBE button so you won't miss any of my future videos. Happy Blendering!

Thursday, January 7, 2010

IPO Drivers and PyDrivers

Join my Blender 3D forum, where you can network with other Blender friends and get your Blender 3D questions answered.

Download the blend file with the code for IPO Drivers and PyDrivers



With basic Blender animation, you create keyframes at different frames in your animation, and then Blender's IPO system fills in the blanks (the technical term is "interpolates") values for the frames in between. Sometimes you might want to base a particular part of the animation of one object, such as its location, rotation, or size, on the action of another object. This is where IPO drivers come into play. For even more sophisticated control, you can create a Python expression to do some really wild things. The purpose of this video is to introduce you to both IPO drivers and Python drivers (aka PyDrivers) so that you can really spice up your animations.

Steps:
1) Keep the default cube. Add Suzanne above the cube. Get rid of the 3D Transform widget, which gets in the way of this demonstration.

2) Go to the setup menu. Choose SR1-Animation. The animation setup is very convenient for animation. It consists of an outline window on the extreme left, a 3D window on the middle, and an IPO Curve Editor window on the right. Additionally, there is a timeline window under the 3D window and IPO Curve Editor window, and a Buttons window at the bottom.

3) Let's animate the monkey's movement along the X axis. We'll set the length of the animation to 50 frames by setting the End frame to 50. We're at Frame 1. Insert a Loc keyframe by pressing the I key and selecting Loc. Move to Frame 50. Note how the vertical green line in the IPO window moves to Frame 50 as well. Move the monkey 5 blender units to the right. Then press the I key and select Loc. Note that a curve is generated in the IPO window. We can't see all of it. To see all of it, from the View Menu of the IPO Curve Editor, select All. Alternatively, you could have pressed the Home key.

Interestingly, there are 3 curves that were created, corresponding to LocX, LocY, and LocZ. Left click on LocX. The highlighted curve a curvy line, from 0 to about 5, corresponding to the blender units on the X axis for the monkey's position. There are 2 dots that represent the end points of the curve, at frames 1 and 50. You placed the monkey at a specific X location on Frame 1 and Frame 50. Blender interpolates, in what's called a Bezier interpolation, the monkey's location for the frames in between. The monkey speeds up in the earlier frames, goes relatively constant, until the last 10 or so frames, where the monkey slows down.

An alternative interpolation method is called Linear. In this case, the monkey's speed is constant. Actually, Bezier is a more realistic type of interpolation. Feel free to experiment. To change to linear, select Curve - Interpolation Mode - Linear, from the IPO Editor Window. Press Alt-Shift-A to animate, which animates no matter where the cursor happens to be. Now the speed of the monkey is constant. Press Esc to end the animation.

Left Click on LocY. The monkey's Y location stays at roughly 3 blender units for the entire animation. Let's change that in the IPO Curves Editor window. To do that, select LocY. Press Tab to go to Edit mode. We're going to change the end Y location of the monkey. Right click to select the end point. Press the G key. Left click and drag to about 5 Blender units, giving a Bezier type curve in the Y direction. Press Alt-Shfit-A to animate. Now the monkey goes up in the Y direction as well as across in the X direction. Press Esc to end the animation.

The LocZ curve also was created. The Z position of the monkey stays at 0 no matter where we are. You won't see the Z location change in top view because we're looking down, in the negative Z direction. Press Num 1 to go to Front View. This time, we'll make the monkey jump up and down. Press Tab to go to Edit mode. We'll change the LocZ by adding a point on the curve. To do this, position the cursor about halfway between the beginning and the end and press Ctrl-Left Click. This creates a new point. Press the G key and drag the curve up 3 Blender units. Press Shift-Alt-A to animate. The monkey jumps up and down. Press Esc to end the animation.

4) Great! We've animated the monkey in 3 directions. Now suppose we want to make another object, like the cube, follow the monkey. If you shift-Left Click on LocX, LocY, and LocZ, you'll see that our animation is a bit complicated to copy. Select the cube. Trying to copy these curves is tedious. Also, if we change the monkey's animation, we'd have to redo the cube's animation. Very quickly, I think we'd give up.

This is where IPO drivers come into play. We want the cube to follow the monkey in the X direction no matter where the monkey goes. To do that, select the LocX channel (that's the technical name) in the IPO Curves Editor. We're going to add a driver. Click the Add Driver button. In the Ob: area, enter the name of the monkey mesh, Suzanne. There are 9 possible channels that can drive the cube. Select LocX. Note the dotted rectangle icon representing a driven LocX channel. Press Alt-Shift-A to animate. See how the cube follows the monkey across.

5) With a PyDriver, we can get even more cute. Suppose we want the cube to follow only at half the speed of the monkey in the X direction. Press the N key in the IPO Curves window to bring up the Transform Properties window. Press the little snake icon (I guess it's a python). You can enter a Python expression, in this case:

ob("Suzanne").LocX/2

Make sure you enter this exactly, observing the case. Otherwise, Python will give you an error message. Press Shift-Alt-A to animate. Note that the cube is only going half as fast as Suzanne in the X direction. Press Num7 to go to Top View. Press Shift-Alt-A to animate. The animation works the same way in top view. This would not work be possible with a simple IPO driver. You can animate multiple objects. Try doing a "monkey race" with different denominators for each monkey's speed relative to other monkeys. You can also animate rotation and scale. Imagine the possibilities. This animation can be used in the game engine, as your aliens and monsters fight each other.

I hope this has given you some ideas about how to animate your Blender projects. If you liked this, click the big Subscribe button in Youtube so you won't miss any of my Blender tutorials. Happy Blendering.

Monday, January 4, 2010

UV Image Editing

Join my Blender 3D forum, where you can network with other Blender friends and get your Blender 3D questions answered.



The purpose of this video is to show how to edit an image in the UV / Image Editor in Blender 2.49b. Editing an image with the UV / Image Editor is important when you're combining (the technical word is "compositing") images and objects into a final render, as well as for creating custom textures. The process involves mapping a 3D surface onto one or many 2D images, a process called UV unwrapping a mesh. The mapping is done on each face. It's possible for each mesh face to have its own image mapped to it. We'll start with the simplest case of UV unwrapping, unwrapping an image onto a plane, which has, of course, only one face. We'll work our way up from there.

1) Erase the default cube (right click on the cube, then press the Delete key, then Enter). Add a plane (Space - Add - Mesh - Plane). Scale it up 3 times (S - 3 - Enter). Split the window horizontally by right clicking on the 3D Window bottom border, choosing Split Area, and positioning the double arrows so that the window is split.

2) We're going to play with a picture of me, in front of one of the 26 palaces of the King of Morocco, in Rabat, Morocco, projected onto a plane. It's good to be the king. Select the plane. Tab into Edit Mode. Press the A key twice to make sure that all the vertices are selected. Press the U key to unwrap the plane. Choose the default Unwrap method. The result: after you unwrap the plane, in the UV / Image Editor you should see a square with 4 vertices - actually, it's a face.

3) The next step is to load my image. From the UV / Image Editor, select Image, then Open. Select the Image. You might need to use the Zoom In and Zoom Out keys (Num+ or Num-) to position the image so that it fills up the square. There's the picture. In the background are soldiers, in their typical position before the Morrocan Changing Of The Guard.

4) The next step is to get my picture to display, both on the plane in the 3D view, and in rendering the image. We want the camera to see the image projected on a flat plane. To do that, from the View menu, press Align View, then Align Active Camera to View, or press Ctrl - Alt - Num0. Press F12 to render. The plane renders right now with the default gray material.

5) To get my picture to render, we need to tell the renderer to use the texture face (TexFace), which is the image from the UV / Image Editor. To do that, go to the Shading buttons (F5), select the default material (Material). Then, turn on the TexFace button. Now Press F12 to render. A bit better, but the image is upside down. We'll fix this shortly.

6) To see my image on the plane, go to View Properties. Turn on the SolidTex button. If the image still doesn't display, make sure the 3D View is in Solid mode. Now you can see me, upside down, as in the render. How can we fix this? In one of two ways...either by rotating the image in the 3D view or rotating the image in the UV / Image Editor. We're not going to change the geometry in the 3D view. We'll fix it in the UV / Image Editor. To do that, with all the vertices selected, press the R key, then rotate it 180 degrees. You can hold the control key down when you're close to 180 (you can see the rotation at the bottom of the UV / Image editor). That way you get exactly 180 degrees.
Press Enter and the image is now correct, both in the 3D view and the UV / Image Editor.

7) The entire image doesn't have to be mapped to the plane. To show that, go to the UV / Image Editor, with all the vertices selected. Press the S key to scale. Reduce the square to a rectangle syhowing only part of the image. I'm scaling the square down to a rectangle which focuses more on me than on the palace. The square is now a tall rectangle. Press F12 to render. Gee, I gained some weight. Moroccan food can be fattening, I guess.

8) The reason for the weird result is that, although the plane starts out mapped to a square area on the image, when I scaled it down, it became wrapped to the rectangle. The rendering stretched my stomach out, to fill in the plane's square area. That is the problem with UV unwrapping. Each face is mapped in its own way to an area of the image. The way that you unwrap a mesh makes a big difference. I'm going to show you how it can get even more weird. Press Ctrl-Z to undo the edit. That's the fastest diet on record.

9) We can do much finer edits, simply by adding more faces to the plane. To do this, position the cursor inside the 3D view. Press the W key to bring up the Specials menu. Select Subdivide Multi. Make the number of cuts 5. Of course, it can be any number you want. This gives us a 6 x 6 grid, with 36 faces in total. Go into Face Select mode by clicking on the triangle icon. Press the A key to deselect everything. Select a face in the 3D view. In the UV / Image editor, you see both the loaded image, and the part of the image that is mapped to that particular face.

10) Let's see what those guards are really doing. Easy enough. Select the faces that map to the part of the image where the guards are. Press the S key to scale them up a bit. Press F12 to render. They have really neat uniforms, don't they?

11) We can also edit from the UV / Image Editor. Position the 3D cursor in the UV / Image Editor. Box Select the area mapped to my shoulder. Press the R key to rotate it a bit. Now I'm bending my body in a strange way. Press F12 to render.

12) To show you why the projection method makes a difference, I'm going to unwrap the plane based on the Sphere from View projection. The result is as if both me and the King's palace were put through a blender which, in a sense they were. Thank God for Ctrl-Z.

You should play with all the different projection methods in Blender. A cube projection of an image actually will work fine. You can unwrap it and then scale the UV squares to fit the image. You can unwrap as many times as you like. Each unwrap undoes the previous one. However, you can have multiple unwraps if you want. The way to do that is to create a new texture map. The default name is UVTex. Click New and unwrap - the default name is UVTex.001, which you can change - and you can experiment with different unwrappings.

I hope this gives you a start in using the UV / Image Editor. Be sure to hit the Youtube Subscribe button so you won't miss any of my tutorials. Happy Blendering.

Saturday, January 2, 2010

Blendervideos.com



BLENDERVIDEOS.COM BLENDER VIDEOS WEB SITE

I don't claim to have a monopoly on Blender knowledge. Quite the opposite. Blender is blessed to have an active community of smart, active users, who are enthusastic about sharing their wisdom with others. A recent example of this is Blendervideos.com, a Blender focused Web site that is, amazingly, only a couple of weeks old (the first post was about December 16, 2009) but, even in this short time, is now crammed with useful articles and tutorials about Blender. The owner, Nathan John, of Bandung, Indonesia (email: blendervideos@gmail.com), is a tireless Blender enthusiast who has put together a truly incredible site that benefits all of us as Blender users. Think of blendervideos.com as "Google for Blender".

The purpose of this video is to introduce blendervideos.com and to encourage you to contribute to it. In addition, I have been asked numerous times questions like Where should I start in learning Blender? What's the best Blender book? Where is all the information I need to get up to speed in Blender? How do I learn about a particular Blender feature? I want to show you how I do my Blender research.

Let's look at the tutorials section of blendervideos.com. Full disclosure: I have already uploaded links to some of my tutorials to blendervideos.com. I confess--I'm always looking for more viewers. To get to them, just search on "Ira Krakow". There are links to 8 of my tutorials. My smoke simulator tutorial, uploaded December 26th, got 900 views. My most recent one, on Ambient Occlusion in Blender 2.5, just uploaded today, has over 400 views already. Not too shabby.

OK, enough shameless self promotion. Suppose you want to find out more about Ambient Occlusion than just my tutorial. Just search on Ambient Occlusion. There are 8 videos, covering a whole range of situations where AO works well -- in the Blender Game Engine (BGE), simulating AO with vertex colors, excluding objects from lights, color bleeding, as well as two others on basic setup. I'm sure you can learn a lot from these videos that I haven't covered in my video. I've been asked whether there's one place where everything about Blender can be found. My answer is "Yes and No", because the answer is that probably anything you want to know about Blender has been written about somewhere on the Internet. However, it's sometimes difficult to track a particular answer to your question easily. What's really lacking is a good strategy to find out your answer.

Let me show you how I track down answers. Let's suppose I want to do a tutorial on rigging. How would I start? The first thing I would do is a Google search on "Blender rigging". By the way, it was not too long ago when if you asked Google this question, you might get pages about kitchen blenders, oil rigs, sailing rigs, maybe someone getting murdered getting hit over the head with a blender (there is an Alfred Hitchcock story about a man murdered by his wife with a frozen lamb chop, which she then served to the police investigator--Blenders are pretty heavy objects). Maybe if you were lucky, you might get a random link to what you were looking for on Page 3 of the results.

Google is much smarter now. The results actually are relevant to Blender 3D, even though you didn't explicitly say "I want to know about rigging in Blender 3D". The top page links to the Blender wiki on Character Rigging in Blender, from the Blender Summer of Documentation (BSOD) which, actually, is a pretty good place to start. Definitely the BSOD page is a must read.

The next link, to squidoo.com, is another great tutorial on the basics of character animation in Blender. There are links also the the Creature Factory, the Mancandy FAQ, how to do a walk cycle, and others. These are also well worth your time. The next links are how to rig a hand and foot, and two Youtube tutorials (I haven't done any rigging tutorials yet, so I know they're not mine). All are I'm sure very helpful.

The next place I would go is Youtube. They say a picture is worth 1,000 words. A video is really a lot of pictures taken quite fast, so a video must be worth at least a million words. There are some pretty fantastic results, including a series of tutorials about rigging and makehuman, an experimental project for producing rigs of human beings just by adjusting some sliders, as well as a woman's body and face rig, and Super3boy's armature tutorial. Again, all of these will help you become a rigging expert in no time.

Blendervideos.com is yet another place to go for enlightenment. Here is the result of that search. We're now introduced to IPO drives, skinning, and auto rigging.

I've heard it said that it's hard to find stuff about Blender. I disagree. There's plenty of stuff out there. The problem is how to find it. I hope that this tutorial has given you some ideas about how to do it. Happy Blendering!