Blender SOFA short Tutorial

Introduction

This tutorial shows how to use the basics functionalities of Blender SOFA. You will learn:

  • to configure Blender so it uses SOFA in the Game Engine;
  • to add physics to Blender objects;
  • to run the SOFA simulation from Blender;
  • to modify the physical parameters of the scene and of the objects;
  • to add fixed point constraint to some models.

Note: We assume the user has absolutely no previous knowledge of Blender.

Obtaining Blender SOFA

You can download Blender SOFA from the Digital-Trainers website.

Once downloaded, you’ll have to extract the archive and start blender.exe.

Setting up the game engine

The first time you start it, Blender should look like this.

First, switch to the Blender Game Engine.

Then, go to the World tab (the one with the little earth on it).

And choose the SOFA physics engine.

From here you can access the global parameters of the Sofa simulation. Make sure Constraints Collision is selected under Sofa physics – Type.

Adding physics to a Blender object

We will now add physics to the cube that was automatically added to the start scene. For a start, we will make it fall under the effect of gravity.

Switch to the physics panel (the last one, with the bouncing ball).

Activate Sofa Physics for the object.

And choose Rigid Object as the type.

Starting the simulation

Let’s see how it all goes together.

From the Game menu, click Start Game Engine. Pressing p while the main view is in focus will have the same effect.

The view changes from the modelling perspective to the game view, and we can see the cube falling.

Press Escape to stop the game engine.

Adding collisions

We will now create the ground to stop the falling of the cube.

Preparing the scene

The first step is to move the cube higher to set room for the ground. Then we will create the ground itself.

The easiest way to move the object along the Z axis is to click and drag the blue translation handle connected to the cube. Move the cube at least 2 units up.

We will now create the grid. On the left side of Blender, switch to the Create palette.

The ground is modelled as a 2D grid, so we clik on the Grid object.

It should have created a grid, going from (-1;-1) to (1;1), with 10 subdivisions in each dimension. In case the grid is not correctly place right under the cube, you can translate it with the red and green translation handles.

The grid we just added is a little bit small, so we want to scale it up. Click on the little ‘+’ sign in the top right corner of the main view.

It will open up a new panel

You may have to scroll up to see the transformation of the object.

You may have to scroll up to see the transformation of the object.

Change the scale to 5 in the X and Y directions.

The grid is now bigger than the cube.

Activating the collisions

We now have to modify the properties of the two objects in our current scene to activate collisions, so they can interact one with the other.

With the grid still selected, go to the physics panel, and click on Sofa Collision. Make sure Mesh is chosen for the type. You will have noticed that we did not activate the Sofa Physics for the grid object. This means that it will be static during the simulation.

We will now select again the cube. To do so, click with the right mouse button on the cube. You can see that the yellow outline has been removed from the grid object, and is again around the cube.

In the physics panel, activate the Sofa Collisions for the cube.

We will also rotate the cube so that it doesn’t fall flat on one of its face.

One way to rotate an object is pressing r when the main view is in focus, moving the mouse around and left-clicking when satisfied. You can also edit the rotation values manually under Transform, in the panel we opened previously on the right side of the main view.

Start the game engine (p or menu Game->Start Game Engine, then Escape to stop it). The cube is now stopped by the grid.

Deformable objects

We now want to modify the cube so that it can deform under its weight when it comes in contact with the static object underneath it.

With the cube selected and in the physics panel, change the Sofa Physics type to Regular Grid FEM.

New parameters will appear that are related to this type of object.

You can change those parameters to change the behaviour of the model. For instance, try decreasing the Young Modulus parameter.

If you run the game engine, you should now observe the cube deforming according to the Young modulus you have set.

Clothes

Selecting the fixed points

The first step is to define a set of fixed points that will maintain the grid in its position. For this purpose, we will add the four corner vertices into a new vertex group.

First select the grid by right clicking it in the main view.

Switch to the Edit Mode either through the menu, or by clicking Tab.

All the points, edges and faces in this object are now selected.

Right click a corner point, then shift-right click the three other corners to select only those four vertices.

Switch to the object data panel.

Click on the ‘+’ sign button under Vertex Groups.

A vertex group has been added, with the default name ‘Group’. Click on the Assign button. The selected points are now added to this group.

You can now switch back to the Object Mode (you can also do it by pressing Tab).

Adding the physics

Go back to the physics panel, activate the Sofa Physics for the grid and select the Triangular FEM type

Some parameters are similar to the ones we saw for the deformable cube, but with different default values, and sometimes slightly different significations. You can hover the mouse cursor over a parameter to see a brief description.
Under Fixed Points, we should see the name of the vertex group we just created.

When running the game engine, we should now have a deformable cube falling on a cloth that has its four corners fixed in space.