You are on page 1of 21

Chapter 15: Blender Bonuses

By Roland Hess

Blender’s functionality goes way beyond what has been shown in this book. You’ve no doubt seen a lot of
buttons that were never touched in the tutorials, and settings that were not explained in the discussions. In
addition, there are entire sections of Blender that we haven’t even mentioned. Just to give you a sense of
what to tackle after you’ve mastered the basics, here is a brief look at some of those items.

Rigid Body Dynamics: Bullet

A rigid body dynamics simulation environment lets you create setups of solid objects and have the system
treat them as though they were real objects, conforming to the laws of physics. Rigid body dynamics can
simulate something as simple as a brick wall breaking to pieces, or something more elaborate like a
complicated Rube Goldberg device. Blender has built in support for rigid body dynamics simulation using the
Bullet Physics SDK (Software Development Kit).

This is mainly used to support a Game Engine. Through the use of built in programming tools and internal
logic and control systems, you can create a fully-functional game directly within Blender. A “game” could be
a complex racing simulation like “Club SILO” from Luma studio (http://luma.co.za), or a ball that you push
around a maze. Within any game, though, the Bullet physics engine is at work behind the scenes, making
things happen in an efficient, realistic manner.

Even if you don’t want to create games, though, Bullet is useful to the animator and still artist. Many times,
you need an added touch of realism, mostly where gravity and collision are concerned, and it can be tough
to keyframe such things believably. In Blender, you can use the rigid body dynamics of Bullet to do the
heavy lifting.

Record Game Physics to Ipo

Blender can record Bullet rigid body simulations into an object’s animation curves. On the main header is a
“Game” menu, under which you will find the option “Record Game Physics to IPO.” By enabling this setting,
the game engine will bake the locations and rotations of any dynamic physics objects into animation Ipos
that can be played back later as a standard animation.

A Basic Rigid Body Sample

On the included disk in the “examples” folder is a file called PhysicsAnimationBakingDemo.blend. Open this
file, position the mouse inside the 3D view and press the P-key to start the Game Engine. After a while,
press the Esc-key to stop the simulation, and the newly generated Ipo curves should be visible inside the Ipo
view.
The Physics Baking Demo

Rigid Body Settings

Objects are identified for use by the physics engine as Static objects by enabling their Actor button in the
Logic buttons. Static objects are useful to represent environments in a simulation: the ground, buildings and
other non-movable objects. If objects need to be moved by the physics engine, the Dynamic and Rigid Body
buttons must also be enabled.
The Logic buttons.

Collisions

Any objects that have their Actor button enabled are detectable for collisions. Objects that collide with other
objects will react as they would in the real world, knocking each other around based on their mass settings
and momentum. Blender 2.43 added support for compound collision shapes for rigid body objects that are
part of a parent-child hierarchy. You can enable compound objects by choosing the new Compound button
for the parent objects:
Compound collision objects.

Compound collision objects let you build complicated structures, with each part having its own type of
collision boundaries.

Rigid Body Constraints

Some objects may be dynamic rigid bodies, but their movements should be limited. For example, a door can
normally only rotate around its hinges. This hinge would be a constraint. To simulate a chain of connected
objects, you can limit the motion of each part in the chain so that the objects stay within a certain distance of
one another. These types of constraint relationships are built with the Rigid Body constraint type, in the
Object buttons.
Rigid Body Constraints

More About Rigid Body Physics and Bullet

You are invited to visit http://www.bulletphysics.com for some cool demos, and lots more information.

COLLADA Physics Support

Several other 3D tools and game engines support COLLADA, an open interchange format for interactive 3D.
One of the unique features of COLLADA is it’s capability to represent rigid body information. Blender 2.42
and later supports COLLADA Physics import and export. This means that the rigid body information that has
been set up can be exported and imported through COLLADA 1.4. This can be useful when authoring rigid
body data for external game engines like Ogre 3D and C4.

Soft Body Dynamics

Blender has another physics simulator, one for working with soft bodies. Think of gelatin wiggling on a
moving plate, a banner flapping in the wind, or the bounce of body fat as a character jumps across a
landscape.

A mesh object is set to use Soft Body dynamics by enabling the Soft Body button on the Soft Body panel of
the Physics buttons, where the Particle controls are found.
The Soft Body controls

If you load the file “softbellyhank.blend” from the “examples” folder on the included disk, you will find that
Hank from the character animation and rigging chapters has put on a few pounds. Soft body dynamics have
been applied to his enlarged stomach so that it rebounds as he walks.
Soft belly Hank

Soft bodies work with the concepts of “goals” and “springs.” In short, the goal is the original, modeled shape
of the mesh, and the Goal controls on the panel tell the simulator how rigorously the mesh should attempt to
meet that goal shape. The Edge controls at the bottom of the panel control “stretchiness,” or how and how
much the edges of the mesh can act as springs and stretch as they go about their soft body business.

In the case of Soft Belly Hank, only the stomach is affected by the soft body system. This is because soft
bodies can be restricted based on a vertex group. By creating a vertex group with a low weight on the
stomach and a high weight on the rest of the mesh, the soft body system can be told to use those vertex
group weights for goals.

Soft bodies can also be used to simulate cloth, although at this time a full cloth simulation for something like
an animated character’s clothes isn’t practical.

In addition to the basic soft body simulations, the system can take colliding objects into account, as well as
check for self-collision within a soft body object to keep it from intersecting itself. Standard and self-collision
detection add another level of realism to the soft body simulator.

Fluid Simulation

In addition to rigid and soft body physics, Blender has an integrated fluid simulator. Based on the Lattice-
Boltzmann Method, the fluid system produces excellent results that are limited only by the computational
strength (RAM and CPU) of your particular machine.
A fluid simulation requires several components: a domain (the area within which the simulation takes place),
a fluid (a mesh that defines the starting shape and location of the fluid) and obstacle objects. You can also
include objects that will add fluid to the simulation over time (inflows) or remove it (outflows). These are all
defined by adding separate objects to your scene, then enabling each for fluids on the Fluid Simulation
panel of the Physics buttons. From there, you use the buttons to define which role the object will play in the
simulation.

The Fluid Simulation assignment buttons.

After all of the objects are defined, the simulation is run by pressing the Bake button. Using high resolutions
can take enormous amounts of time and memory, but most modern systems should be able to handle small-
scale needs like water pouring into a glass, etc., without much trouble.

The final product of the fluid simulation is an animated mesh object that can use any standard Blender
material, with careful settings to mimic water or other fluids producing excellent visual results.
Some examples of Blender's fluid simulator, courtesy of Mike Pan.

Creating your own fluid simulation is simple.

Start a new scene, select the default cube and Enable it as a Domain in the Fluid Simulation buttons.
Click Enable, then Domain.

Add an Icosphere, positioning it within the cube and scaling it down to fit completely inside. Then, Enable the
sphere as the Fluid.
The icosphere inside the cube, Enabled as a Fluid.

One thing to be aware of before you actually do any simulation is that the Domain object, in addition to
defining the area in which the simulation takes place, becomes the actual animated fluid. Don’t be surprised
when you see your nice fluid sim, but your Domain object is gone. The Domain object is the fluid sim.

In a timeline (or Render buttons) window, set the animation End frame to 75 or so. Reselect the cube and
click "Bake" on the Fluid Simulation panel. Wait a couple of minutes. The progress bar on the main header
will show how far the simulation has progressed. It will also show itself working in the 3D view. When it's
done, just press Alt-A in the 3D view to see the simulation. For a better look with higher resolution data, you
can change the dropdown menu that reads "Preview" to "Final."

If you fluid simulation is taking too long to calculate, you can press the Esc-key to cancel.

Python Scripting

Blender includes a programming language called Python. By writing or loading Python programs within
Blender's text editor, you can extend Blender's functionality in almost any way you can imagine.

A simple script to select an object's parent looks like this:


Of course, you don't have to be a programmer to take advantage of the creativity of others. Tucked away
inside several of Blender's menus are Python scripts, ready to use. In fact, you may have already used them
without knowing it. Here are some of the places you can find them:
The last image shows one of the UV Mapping pop-up menus, where the last item "Unwrap (smart
projections)" is a Python script. In the other menus, you can see the little Python snake icon beside the
entries. Each and every one of those is a Python script that is loaded and placed in the menus when Blender
runs.

In addition to being integrated into the menu system, Python scripts can be executed in a number of different
ways. If they are loaded as a text file like the first example, placing the mouse over the text window and
pressing Alt-P will run the script. Scripts in the text editor can also be linked to scenes, materials and objects
in the 3D view. Such linked scripts can be set to run whenever the screen redraws, whenever the frame
number changes, or at render time. This kind of link gives scripts the ability to control and alter objects in
real-time as you work, over the course of an animation, or just during the render.
A script called "MakeMonster" linked to a selected object, and set to update every time the frame number
changes.

Some of the more complex Python scripts can do things like create an entire system for exporting to and
driving Renderman compliant renderers, or simulate crowd motion with full character animation.
The Neqsus Renderman exporter (courtesy of Bobby Parker), and BlenderPeople crowd simulation.

Although a Blender installation comes with a Python interpreter built in, if you have the full Python
programming language installed on your system already, Blender's Python environment will happily use your
installation, including any special modules or packages you have installed. This means that your capabilities
with Python scripting in Blender are almost limitless. Future development plans for Python within Blender
include the ability for Python scripts to create and control their own UI panels directly within the main
Blender interface.

Coming Soon!

With an active and creative development team, there are even better things on the horizon.

Currently in the works:

- The ability to remap hotkeys and control events, meaning that users can truly customize their own
experience. Keyboard maps that simulate other 3D applications to ease transitioning users will no doubt
become popular.

- A completely new particle system with excellent support for hair and fur that includes intuitive, interactive
controls for combing, growing and cutting hair, as well as a host of new methods of particle visualization and
control.
- The next Google Summer of Code will no doubt include several great Blender projects. In the past, the
GSoC has brought us the modifier stack enhancements, multiresolution sculpting, FFMPEG, the IK rewrite
and improvements, and the fluid simulator.