How to use the SporeModder Blender Addons - emd4600/SporeModder-FX GitHub Wiki

The SporeModder Blender Addons allow you to export models to Spore using the 3D modelling software Blender. Most 3D objects in the game are models: parts, backgrounds, cities, rocks, adventure objects, weapons,... The Blender addons allow you to easily replace and create new models.

In this tutorial, we'll go through the process of creating a fully animated part with Blender and the addons. Here we will only cover the process related with Blender; things like adding the page to the editor will not be explained: you can have info about pages and creature parts in other wiki pages.

In order to be able to easily test our model, I have created a very simple part mod example. This project only adds a new page in the Mouths category with a new mouth model. Notice how all files in the mod start with CustomPartTutorial_: that is a prefix to avoid those filenames from colliding with files in other mods. You should change that prefix to your mod name or initials, to ensure that the filenames stay unique. You can download the mod project here, you must unzip it and add it to the SporeModder FX Projects folder: https://mega.nz/#!fIVVGIDI!eAK8S9t7QcnkNLUmJN1VQjkxwAYoDneEo0MVDWpuvWg

Installing the Blender addons

  1. Download the SporeModder.Blender.2.8.Addons.zip from the latest release page.
  2. Open Blender, and click the Edit -> Preferences... menu.
  3. In the dialog that appears, go to the Add-ons tab and click the Install... button.

  1. Find the .zip file you downloaded in the File Browser, select it and click on Install Add-on from File...
  2. The Import-Export: SporeModder Add-ons item will appear, enable it byb clicking on the square box:

When you open Blender, you always start with an already existing model: the default cube. As the first part of the tutorial, we will try to export this simple cube.

Exporting to RW4

To export the current scene into a .rw4 file, which is what Spore uses for models, use the button File -> Export -> Spore RenderWare4 (.rw4)

A file browser will appear to let you choose where you want to save the file. When you are done, click on the Export RW4 button:

Aaaand that's actually it. There you have your .rw4 file. Quite easy, right?

So now let's try it in our test mod. We just have to replace the file editor_rigblocks~\PartTutorial_ce_mouths_test.rw4 with the file we just exported. You should also replace the file part_models_lod1~\PartTutorial_ce_mouths_test.rw4, which is the one used when you save the creature.

Now pack the mod with SporeModderFX and open the game. In the mouths category there should be a new page with our custom part.

There you have it! You will notice it looks very big, though. In Spore (and in Blender), every unit represents 1 meter; for reference, creatures are usually about 2 units high. Our cube model is 2 units wide, that's why it looks so big in-game. Keep this in mind when you model your parts.

But a cube loooks kinda lame, right? How about we try with a real part?

This is the Willosaur Mouth, its model was found in one of Spore prototypes. You can download the .blend file here: https://mega.nz/#!iMEXkI6I!DrL_FbhGQUH_uKgnrTIg35vc_6kD4iThyjIclTKo52A

Open it in Blender and export it. We will continue this tutorial using that part.

Applying a texture

If we want the model to look better, we need a texture. Spore requires a special format for textures, .dds; here you have a tutorial about how to export images as DDS. For this part I already designed a texture, which you can download here.

To apply a texture, first we must understand Materials. Mesh objects in Blender have one or multiple materials, which define how the object is "painted". Every Blender material comes with a set of properties related to Spore. Even though you can have more than one material per object, for this tutorial we will only use one material, which already comes with the model. The Material Panel is found in the Properties panel, which looks like this:

If you scroll down the panel you will find the RenderWare4 Material Config, which are the properties related to Spore:

The first property defines which type of material we are using. SkinPaint Part is for creature parts, but if we wanted to create a building part we would have to use a different type. The material types of materials are explained in more depth in this tutorial:

We are now interested in the Diffuse Texture property, which is the texture that our part is going to use. Mind you, this only affects the part in the Build Mode; the textures used in Paint Mode and when saving the creature are defined in the .prop.prop_t files inside the mod ([more info here])(https://github.com/emd4600/SporeModder-FX/wiki/Creating-Custom-Part-Rigblocks). Click on the folder button and find the .dds texture you created (the addons only support .dds textures! If you have another format, convert it as explained in this tutorial). Now export the part again:

Looks better, doesn't it? ;)

Animations

Animations are used in Spore for:

  • Movements: open mouth, bite, sing,...
  • Morph handles: the handles that are used to deform a part.

Spore supports 2 ways of doing animations:

  • Shape Keys (a.k.a. blend shapes): You animate by directly editing the geometry of the model.
  • Skeletal Animation: You create a skeleton for the model, and assign geometry to each bone. You animate by posing the skeleton.

Shape Keys

Animating with shape keys consists in creating alternative versions of the model, and then interpolate between those versions. Note that you can only move vertices, not create new geometry. Very important, though: shape keys cannot be used for movements. You can only use them for morph handles. Another important thing to note is that you can only have one object if you use shape keys (not a problem in creature parts because we only use one object).

To add shape keys, select the object and go to the Object Data tab in the Properties panel, which is on top of the Material tab.

There is a subpanel there called Shape Keys. Click on the + button to add the basis shape key, which represents the undeformed model. Add another one for every version of the model you are going to use; for example, I will add another one that makes the teeth bigger. Important: ensure the box Relative is selected:

To make the different versions of the model, first you have to select the shape key you want to edit, and then edit the model. The changes are only visible in Edit Mode (pressing Tab); when you exit it, the model is back to normal.

Creating the animation

Once you have all the shape keys you want, it's time to create the animation. For that, we are going to switch the bottom panel to the Dope Sheet mode.

There, we are going to use the Shape Key Editor:

To create a new animation, press the New button. We msut give the action a name, and the name is important; I'll call it DeformAxisForward, which is the name used for the morph handle that goes forward. Here you have a full list of handle names. It's important that you press the shield button next to the name, otherwise the animation might not get saved:

So, how does the animation work? By using keyframes: we remember the state of the model at a few strategic moments (for example, at the beginning and at the end of the animation), and the program/Spore will calculate the rest. You will see that in the Dope Sheet panel there's a timeline, where each unit is a frame; animations in Spore are 24 frames per second. Animations usually start at frame 0 (and not frame 1 like Blender does by default) and they last 1,25 seconds, that is, they finish at frame 30.

Expand the Summary item and you will find all your shape keys, with a slider next to them. That value is the influence: 0 means the shape key is ignored, 1 means the shape key is totally used. You can combine different values for different shape keys. If you edit the value, you will see a point appears in the timeline: that is the keyframe. When you are done with that keyframe, move the blue handle in the timeline to change the keyframe, and edit the values for that new keyframe.

(in Blender, when a value is yellow it means it is keyframed)

For example, for the teeth deform, at frame 0 I have given it 0.0 influence (so the normal model shows) and at frame 30 I have given it 1.0 influence (so the full deformed teeth show).

Configuring the morph handle

If this animation were a normal movement, such as opening mouth, we would already be done For morph handles, however, we have to configurate them in the Scene Properties tab in the Properties panel.

There's a subpanel there called RenderWare4 Animations, with a list of all the animations in our model. Select the DeformAxisForward one and check the Morph Handle box. This will show up more properties relating to the handle:

Also, a blue bar has appeared in the model:

The blue bar represents the trajectory that the handle will do; if you change the Start Position and End Position properties the bar will change accordingly. Based on our handle name the addon automatically calculated them, but feel free to change them if you want.

Another important property is the Default Progress. 0% means that, by default, the handle will be at the start position and the animation at frame 0; 100% means that by default the handle will be at the end position and the animation at frame 30. Usually Spore parts have the default progress that makes the part look in the "standard form" it was modelled, so change that if you want too.

We're done with the morph handle animation! Export it and test it; here you can download my version.

Skeletal Animation

Skeletal animation is the more common type of animation used in parts. To do it, we will create an "skeleton" (in Blender, it's called armature) that resembles the shape of our model. Then we assign ever vertex to one or more bones in the skeleton (don't worry, it can be done automatically): when we move a bone, all the vertices assigned to it will move too.

Skeletons work as a hierarchy: each bone has a parent bone; when the parent bone is moved, all its children move too. There's one bone that won't have a parent, that is the root bone. In Spore, the root bone is always at the origin of coordinates (which is where Blender places the bone by default).

Creating a skeleton

So, how do we create a skeleton?

  1. Use the menu Add -> Armature:

  1. In the Properties panel, enable the option In Front. This will make the armature be visible through the model (this is optional, but it makes creating the armature easier):

  1. Press Tab to enter into Edit Mode. A bone has two parts: the thick extreme is the head, the thin extreme is the tail. You can move it using the same controls used when editing vertices, jsut remember that the head of the root bone must be at the origin. If you press E, a new bone will extrude from the selected bone, which will be its parent. Using this you can create something that would resemble the bones of your part.

Keep in mind that the skeleton does not need to be realistic, but practical. You sould use as few bones as possible as long as you can still animate them correctly. I will go with this simple setup:

It's recommended that you give each bone an orientative name (without whitespaces). For example, I have named them UpperJaw1, UpperJaw2, LowerJaw1, etc

Assigning the skeleton to the mesh

  1. Go back to Object Mode
  2. Select the mesh object
  3. Press Shift and select the armature object. Now both the armature and the mesh will be selected.
  4. Press Ctrl+P; on the box that appears, click on the With Automatic Weights button.

Now, how do we test the skeleton? Select the armature object, and go to Pose Mode like shown below. Now, when you move, rotate or scale a bone, it will also transform the mesh.

If you try rotating bones to open the mouth, you will notice something weird...

The automatic weights don't always work as we would want to, so quite often we will have to fix it manually. If you select the mesh object, you can go to Weight Paint mode which can be used to assign vertices to bones with a brush. However, I will show you how to do it manually, because sometimes it is more practical.

Fixing the bone assignments

Go back to Object Mode, select the mesh and go to Edit Mode. The first thing I'm going to fix are the teeth. If you select one vertex of a tooth and press Ctrl+L, Blender will select all the vertices connected to it; with this, we can select easily have the whole tooth selected.

The first thing we will do is remove the existing weights on the tooth. Go to this tab in the Properties panel: .

There is a subpanel called Vertex Groups, which contains a list of all bones. Under the + and - symbols there is an arrow, if you click on it it will display a menu. Click on the Remove from All Groups button.

Now we want to assign the correct bone to the tooth. Select the bone in the list that you want to assign to these vertices (in my case, it will be LowerJaw2). Ensure the Weight bar is set to 1.0, as that is the influence that these vertices will receive from the bone (1.0 because we want them to be completely influenced by it). Now click Assign.

Now repeat the process for the other teeth and any other parts you have to fix (in my case, I also had to fix the tongue). Once you are done, the model can be posed correctly:

Normalizing bone weights

Spore has some restrictions with bone weights, basically two:

  • They must be normalized (the sum of bone weights in a vertex must be 1.0)
  • A single vertex can only be assigned to a maximum of 4 bones.

To ensure our model fits those conditions, you must select the model and go to Weight Paint mode:

  1. Click the menu Weights -> Limit Total. A small box will appear, ensure that the limit is set to 4.

  1. Click the menu Weights -> Normalize All:

You can download the model with the skeleton here: https://mega.nz/#!PB91zCzD!ndY0gmzAGC8Dz1YGxz-WPA9C1W16HYAraZ32Iea5oHQ

Creating the animation

Finally, the last step of the tutorial. Like when we added shape keys, go to the Dope Sheet panel. For skeletal animations you need to use the Action Editor, instead of the Shape Key Editor.

What we are going to add is not a morph handle, but a movement; that is, an animation that is played automatically by Spore. Movement animations are simpler than handles because they don't require any extra configuration; you just need to use the appropiate name. There's a full list here. There are 3 animations that can be used by mouths, but we are only going to add the most important one: ClsdOpen.

  1. Select the armature object.
  2. On the Action Editor, click on the New button.
  3. Rename the action to ClsdOpen. Don't forget to click on the shield so the animation gets saved:

Now go to Pose Mode. In the Action Editor timeline, move the time to frame 0. According to the documentation, ClsdOpen at frame 0 is the mouth closed, and at frame 30 is the mouth open. So now you have to pose the mouth as if it were closed; in our cose that's simple, because it's already closed. How do we make Blender to remember the pose?

  1. Use the letter A to select all bones (in Pose Mode!)
  2. Press the letter I
  3. In the menu that appears, click on LocRotScale

You will see that some points have appeared in the timeline: those are the keyframe (for each bone):

So now, move the time bar to frame 30, and pose the bones to make the mouth fully open. To pose bones you can rotate, scale and move them. Once you are done, record the keyframe again using I. If you think your animation needs more detail, you can add more keyframes in between.

Result

Done! Now you just have to export the part and test it; you can download mine here. Here's how it looks: