Physics Simulation with Blender


Cloth Simulation with Blender

Introduction

This tutorial covers exporting models from Microstation as .OBJ Files, importing them into Blender for softbody or cloth ohysics simulation, and importing them back into Microstation for rendering with Luxology. Blender is a free 3D modeling, rendering, animation, and game engine software available at http://www.blender.org.

This tutorial assumes the following:

If you have any questions, please post a comment, and I will do my best to answer it.

Also, I am well aware this is mostly a Blender Tutorial on the Microstation Visualization Wiki. If you know how to do this in Microstation, feel free to post it, otherwise this is the best, and cheapest option I know of.

Tutorial

Isolate the items you would like to include in the simulation. In this case, I am creating a table cloth, so all I want to import into Blender will be the table.

 

 

 

Draw a plane over the table. This will become the tablecloth. Two important things to note:

 

  1. Make sure the table cloth is above the table and not at the same elevation as the table. This will make it harder to separate in Blender.
  2. You can also create the cloth in Blender, but I am better with MS so I tend to model what I can prior to import.

 

 

Export the Model as an .obj file. I adjust the stroke tolerance (not sure why), and I invert the X and Y so that it is in the correct orientation when imported in Blender.

 

 

Open Blender (You already installed it right? www.blender.org). Installation and setup is outside the scope of this tutorial.

Delete the default cube (Right click to select->press delete->confirm).

 

 

Import the .obj file of the table and tablecloth. (Fire->Import->Wavefront obj).

 

 

 

You should see the table in the 3D view.

 

 

 

The Blender importer imports the entire .obj as a single Blender object. We need to separate the table cloth from the table. Make sure the object is selected (pink outline) and press tab to enter edit mode.

 

Press (A) to deselect all of the vertices (yellow selected, purple deselected).

 

 

 

 

 

Press “1” or “3” on the number pad to enter the front view.

 

Press “b” and box select just the table cloth. You can also hold down shift and right click individual vertices.

 

 

 

Press P and click “Selected” in the context menu to separate the tablecloth and table into separate objects.

 

Press Tab to leave edit mode. Now you should be able to select the table cloth and table separately in object mode.

 

Select the tablecloth and press tab to edit its vertices.

 

Enter Face Mode

 

 

Select both triangles making up the table cloth and click “Join Triangles” in the mesh tools.

 

With the single quad now selected press subdivide 5 to 7 times. Subdivide is also located in the Mesh Tools. (The more times you press, the better the simulation and the more time it takes to process).

 

Now may be a good time to save the file.

 

Go back to vertex edit mode and make sure all of the vertices are selected in the table cloth.

 

Under Link and Materials in the button window, create a new vertex group, name it “TableCloth”, set the weight to 0, and click assign to assign the vertices to a vertex group. By clicking select and deselect, you can make sure you have properly assigned the vertices to the vertex group.

 

 

Go back to object mode (F7) and select the physics buttons.

 

 

With the table cloth selected click the “Cloth” Button and set a preferred material preset. Enable Pinning of cloth and make sure the vertex group is selected. Enable self collisions under the Collision Tab.

 

 

 

 Select the Table and enable table collision.

 

 

 

 Press Alt-A to watch the animation. It will take time, but Blender will cache it so subsequent replays are faster.

 

 Move your mouse all of the way to one side of the screen until your cursor turns into two sideways arrows.  Right click and select split area.

 

Split the screen similar to the screenshot and change the panel type to IPO.

Click on the IPO to advance to the desired animation frame for export.

 

Save your blender file. I would also advise making a backup as I don’t know how to undo the next few changes without rework.

 

In the button window go to the object buttons and click to apply the cloth modifier. This will freeze a selected frame of the animation into the mesh so we can export the results.

 

 

File-> Export and use the settings shown. You only want to export the table cloth, so make sure you have it selected. Also, make sure rotate X90 is disabled.

 

 

Close Blender when export complete.

 

In Microstation, delete or hide your original plane.

 

Reference in the object file you exported from blender. It should land right on top of the table. Make a copy of the mesh and detach the reference.

 

 

Assign a material and have fun!

 

I will post a second tutorial explaining how to pin vertices of the cloth in a particular location in order to create curtains, drapes, flags, and etc.