Exporting Blender Models

If you run into any problems with these instructions, please leave a post on the forum addressing the issue. (You don't have to register to post there)

Setting up the Exporter

Randrian provides an own OGRE exporter for OpenClonk, which can be found on the renderclonks page[1].

To install the exporter, follow the steps in the contained Readme.txt, which are also listed here for convenience:

copy the files from the folder BlenderAddon to:

  • Linux: ~/.config/blender/[version]/scripts/addons/
  • Windows: [blender directory]/[version]/scripts/addons/

[version] should be the version of the installed Blender e.g. 2.71</p>


enable the addon:

  • Load up Blender, go to File>User Preferences>Addons>Import-Export and enable the "OGRE Clonk Exporter" addon.
  • Then click on "Save User Settings".

HINT: You can also use the search box to look for an addon containing "Clonk".

From now on, you will find "Ogre3D Clonk" as an exporter listed under File->Export.

Preparing the Model in Blender

The model needs an armature. If you do not have any animations, please add an armature and rename the one bone to "main" - which is our convention for single-bone armatures.

Rename the mesh of the object to something meaningful:

Blender MeshName.PNG

Also rename the whole object to the same name.

Blender ObjectName.PNG

Make sure the object has at least one material and give the materials your object name as a prefix (f.e. Rock_Grey or Idol_Gold), because in OpenClonk all material names are global.

Blender MaterialName.PNG


Exporting a Model

Make sure you have the object selected in object mode. For exporting a model without animations, open the exporter (File->Export->"Ogre3D Clonk"), select a directory and click "Export Ogre".

You will then find a .mesh and a .material that you need to keep. The .scene file is not required (if it exists).


Exporting Animations

When working with actions, it is a good idea to click the little "[F]" next to the action name in the action editor to make sure the actions are never deleted.

Blender ActionEditor SaveDatablock.PNG

To prepare the animations for the export, you need to add them as NLA tracks doing the following steps:

Open two windows, one for the "Dope Sheet" and one for the "NLA Editor". In the Dope Sheet, select the "Action Editor".

Blender ActionEditor NLA Editor.PNG

Make sure you have the "Armature" selected in the NLA Editor.

Blender Empty NLA Editor.PNG

For every action you first need to select the action in the Action Editor.

Blender ActionEditor Select Action.PNG

Then you click on "Push Down" next to the action name to add the action as a new NLA strip.

Blender ActionEditor Push Action.PNG

The actions should now all be visible in the NLA editor in separate strips.

Blender NLA Editor ActionStrips.PNG

In the exporter, make sure you have "Independent Animations" selected.

The exporter now also generates a .skeleton file (that must not be renamed).

Modifying the Material file

Graphics.material

Graphics.material is the file which defines which materials to apply to meshes. Manually modifying Graphics.material is crucial to the mesh appearing properly in game. When you export (assuming you are using a texture) your Graphics.material file will look more or less like this (don't worry if it looks somewhat different):

material Rock_Grey
{
     receive_shadows on
     technique
     {
          pass
          {
               cull_hardware none
               scene_blend alpha_blend

               ambient 1.0 1.0 1.0 1.0
               diffuse 1.0 1.0 1.0 1.0
               specular 0.0 0.0 0.0 0.0 12.5
               emissive 0.0 0.0 0.0 0.0

               texture_unit
               {
                    texture Rock_uv.png
                    tex_address_mode wrap
                    filtering trilinear
               }
          }
     }
}
  • If 'depth_write off' exists, delete that line.
  • If you are using alpha, make sure 'scene_blend alpha_blend' exists (as shown above).
  • If your mesh has visible backface(s), make sure to add 'cull_hardware none' (as shown above).
  • Depending on the method you used to define alpha in blender, the 'pass' section in Graphics.material may look like this:
pass
{
     ambient 0.500000 0.500000 0.500000 0.000000
     diffuse 0.640000 0.640000 0.640000 0.000000
     specular 0.500000 0.500000 0.500000 0.000000 12.500000
     emissive 0.000000 0.000000 0.000000 0.000000
     ...

If so, make sure the fourth parameter on ambient, diffuse, specular, and emissive is '1.0', not '0.000000' (as shown in the 'material Rock_Grey' example).

Importing the files into OpenClonk

To get the objects into the game, you need to put the .mesh, .material and .skeleton file into your object definition. If you have additional textures (for example an UV map), you need to move the texture into the same folder (you can not rename it after the export).

To view a .mesh file you can use the free tool "Ogre Meshy".

The exporter also comes with a test scenario to view objects ingame. For more information please see the Readme.txt of the exporter.