Tools: Blender        
Image


Introduction

Blender is an open source 3D modeling program. It is one of the most popular programs used for modeling, texturing, animating and rendering. It is available for free, for all major operating systems.
You can create any kind of 3D model in Blender, then export it to be used in your Ogre3D application.
This page covers what Blender can do for an Ogre developer, the tools available and common problems experienced.

Image

Tools

The basic tools are importing information into Blender, exporting it out, any necessary conversions and requirements for rendering in Ogre. The list below is a quick summary of the tools available. Further down the page are more in-depth descriptions of some of the major tools.

Note that all of these tools are created by the community, you and I, just like this wiki. If a tool doesn't have a feature you'd like (or has a bug you'd like to get rid of), perhaps you can persuade the author to work on it, or you are welcome to submit patches. Search in the forum for news and discussions on a particular tool. Features, bugs and project status are often discussed there.

  • OgreXmlConverter - Converts .xml to .mesh
    • Converts a text XML file to a binary Ogre mesh or skeleton file or mesh/skeleton to XML
    • Command line tool installed as part of the SDK, also found in Tools/XMLConverter
    • A Step-by-step How-To can be found here: Blender to Ogre

  • BlenderImport - Imports a single mesh into Blender
    • Meshes and materials are imported
    • Armatures and animations are not, yet
    • See below for more details
    • Found in ogreaddons/blenderimport (in SVN - see FAQ below)

  • Meshes Exporter - Exports meshes and armatures
    • UV mapped textures, many material settings, armatures and animations are exported
    • Found in Tools/BlenderExport
    • NormaliseBlenderMeshForOgre, a Blender script for adjusting bone weights

  • BlenderSceneExporter - Exports a scene as dotScene file
    • Cameras, lights and object descriptions (nodes, entities, material pointers) are exported
    • Individual meshes still need to be exported with the blender exporter
    • Can export custom object properties
    • Found in ogreaddons/blendersceneexporter

  • dotScene Format - (aka DSI) A Framework for loading dotScene files into Ogre
    • Works with the dotScene files created from the BlenderSceneExporter
    • Source and a viewer is included for integration into your project
    • Found in ogreaddons/dotsceneformat

  • dotSceneOctree SceneConverter - Converts dotScene files to binary octree files
    • This tool compiles a dotScene file specifically for use with the dotSceneOctree SceneManager
    • Found in ogreaddons/dotsceneoctree

  • dotSceneOctree SceneManager - A SceneManager for dotScene octree files
    • This scene manager organizes scenes based on octrees within Ogre
    • It accepts files compiled with the above converter tool
    • Found in ogreaddons/dotsceneoctree

  • ogrefsrad - A radiosity processor specialized for lightmap generation
    • A tool for lightmap generation based on Paul Nettle's FSRad, a lightmap generator making use of radiosity techniques
    • Imports/exports dotScene files, imports binary .mesh files, exports to text XML
    • Exports simplified material files (static lightmapping)
    • Found in ogreaddons/ogrefsrad

  • ATI .nmf Interface - Interface to ATI's Normal Mapping Tool
    • Allows creation of normal maps of Ogre meshes

  • Loading *.blend files by Ogre
    • can be done by the project OgreKIT (formerly GameKIT)
    • alternatively just use the blend file parser



Look also to OGRE Exporters - maybe there is something new.

FAQ

General


Where can I learn more about blender, and how to use it?

This is a good introduction to Blender.

The official Blender wiki. More useful as a reference than for learning.
The Blender e-shop: official books and DVDs for learning Blender. DVDs are under Creative Commons license, and can be downloaded legally for free.
WikiBooks: Blender 3D Noob to pro.
Popular third-party websites offering Blender education as video tutorials (mostly free): Blender Cookie, Blender Guru, CG Masters, The Process Diary, CG Tuts+.
A small listing of tutorials from various sources.
Blender Cookie - Many free video tutorials on blender 2.4x and 2.5x.


Blender is confusing, I can't get it to do anything useful

Blender is not a trivial application one can just play with, and hope to guess how it works.
Start at the beginning: follow one or two introductory tutorials from the above-listed websites, and you'll see how the pieces fit together.



What do you mean 'Found in ogreaddons', 'Tools/*' or SVN

SVN (Subversion) is a tool we use to store the source code for ogre. ogreaddons is in a separate directory from the Ogre Rendering Engine SVN repository. For the most up to date copy, browse our SVN Repository and download the latest versions or read the Ogre Community Add-on Projects to learn more about Ogre Add-ons and how to download. Read Getting OGRE From Subversion for more information about Ogre and SVN.

(Note: Ogre and Ogre add-ons used to be held in a CVS-repository, so you may run across references to "CVS" in the wiki pages. You can change "CVS" for "SVN" in those pages and you are fine. They are very similar systems. The link to the repository and tools for reading them are of course changed. See the above links for info.)


What is an Octree?

An octary tree - a tree with 8 children per node. Each node represents a cube. Cut that cube with 3 even slices, 1 down the middle of each face (X plane, Y plane and Z plane). Now your single cube has turned in to how many cubes? The answer is left as an exercise for the reader.

Octree is a space-partitioning technique, an alternative to BSP. Deciding whether to use Octree or BSP depends on several factors, but in general Octrees are better for levels with a lot of open space, or levels that are very dynamic, while BSPs are better for levels with dense, crowded geometry, or levels that are quite static. Octrees usually cost more computationally than BSPs, but that's because BSPs require preprocessing ('baking') and are therefore inherently more static, so that's a tradeoff you'll have to decide on. For comparison, idTech and Unreal Engine use BSPs, while CryEngine uses Octrees.


What is UV Texturing?

Texture mapping. It means applying a 2D image onto a 3D object. You'll need to define UV coordinates in Blender on your object before you can apply a UV texture or expect Ogre to display it properly.



Why do I get some strange python or other errors when running a script?

Blender uses the Python programming language to execute scripts. Some scripts need a full Python environment to be executed. Python is not installed by default on some operating systems, such as Windows.
So be able to execute the script, you'll have to install the correct version of Python on your machine:

  1. check which version of Python is expected in the console, when Blender starts
  2. go to the list of Pyton releases, and download the appropriate version. Only the first two version numbers matter. For example if Blender asks for Python 2.6, then installing Python 2.6.6 is ok, but not Python 2.7 or 2.5.
  3. install Python, restart your computer, launch Blender. It should say it found Python. Otherwise search the BlenderArtists forum, or the Ogre3D forum for a solution to your problem.

Mesh and Armature Exporter


When I select multiple objects in blender and use the export with OgreXML, why do I get so many xml files?

OgreXML is the BlenderExport tool, which is only for exporting a single mesh. Export your objects individually or use the dotScene exporter. You can also join your objects into a single mesh within Blender with Object->Join Objects or Ctrl+J.


My objects look smooth and nice in Blender, but when I view them in Ogre they look all blocky. Why?

You are probably using subdivision surfaces in Blender (subsurf). Blender does not export these surfaces so you get the original mesh you started with. Use the Object->Convert Object Type or Alt+c functions to convert the subsurfed mesh into a real mesh. This will duplicate your object in the same spot. Make sure to select and export only the new mesh for Ogre.


I added a texture to the material definition file after export, why doesn't it display?

If you do not define any uv coordinates for your mesh, Ogre sets them to the default value (0,0). In this case you see the first texture pixel as colour. See Blender's documentation on how to use uv-textures.


Why does the export log say "error in normalize"?

This error happens if the length of the vector to normalize is below some threshold. This may happen in the calculation of face normals (likely) or in the conversion of the armature (not likely). In the case of the face normal you have some really small faces in your mesh, which is usually not what you want. In this case you can use the "Remove Doubles" option in Blender's "Mesh Tools" to get rid of them.


Why does the script abort with an IndexError?

If you are trying to export an object that doesn't have a material, you may get this error:

 Traceback (most recent call last):
   File "<string>", line 3526, in buttonCallback
   File "<string>", line 3179, in export
   File "<string>", line 3052, in export_mesh
 IndexError: list index out of range

To fix this, simply add a material to the object(s).


My model looks squeezed in Ogre. Can I export a mesh object in object coordinates but with object size transformation applied?

No, but you can apply the object transformations with "Object->Clear/Apply->Apply Size/Rotation" (Ctrl+A).
Alternatively, you can apply the mesh object size transformation with the applymeshobjectsize.py script before exporting.


Why does my animation look distorted and weird in Ogre, while it looks good in Blender?

There are several things you can check that can cause a distorted animation:

  • Select your skeleton/armature, go to edit mode and press N, the property window opens, set the "Roll"-value for each bone to zero, unless you intentionally want it different.
  • Go back to Object mode, select your mesh and press N to get the properties window, make sure all "size"-values are positive numbers.
  • Like in the answer to the previous question mentioned apply the object transformations with "Object->Clear/Apply->Apply Size/Rotation" (Ctrl+A), after parenting the object

to the armature, before you animate, or use this applymeshobjectsize.py-script for existing animations before you export.





Why are some of the faces not visible in Ogre although I can see them in Blender?

Usually faces have only one visible side determined by the face normal. You can check visibility in Blender using Blender's internal game engine (P, Esc). Normals can be displayed in "Edit Mode" using the "Draw Normals" option from the "Editing" buttons. You can change normals using the "Mesh->Normals" menu. If you want the face to be visible from both sides in Ogre also, e.g. for foliage, select the face in "UV Face Select" mode and set it to "Two Sided" via the "Face->Active Draw Mode" menu.


What's the purpose of "Game Engine Materials" option?

If you export with "Game Engine Materials" enabled, the exported mesh should look similiar to the mesh in Blender's game engine (Draw type: Textured, P key). If "Game Engine Materials" is disabled on export, the result should look similar to Blender's rendering result (F12 key).


My mesh has a strange rotation or translation in Ogre relative to how it appears in Blender.

The mesh exporter computes the mesh relative its own local coordinate system, not the global coordinate system. One way to fix is this is to reset the local coordinate system in Blender to match the global system (using Transform->Properties), then transform the mesh to the way it should be in Edit Mode, which will not alter the local coordinate system.

dotScene Exporter


How do I define an object or mesh as static for Ogre?

First you need CVS revision 1.2 or higher of the export script. Then select the mesh. In logic buttons (F4), add a property of type "Bool", named "static" and set it to true.

Ogre Blender Import Script


What is the default scale for importing an Ogre.mesh.xml file?

If you are using the http://ogre.cvs.sourceforge.net/*checkout*/ogre/ogreaddons/blenderimport/ogre_import.py?content-type=text%2Fplain script then it will be scaled by 0.1 by default. You can edit the script to change this to 1.0 or some other scale if needed.

See also


Alias: Tools:_Blender