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

<HR>
Creative Commons Copyright -- Some rights reserved.


THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.

BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.

1. Definitions

  • "Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
  • "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License.
  • "Licensor" means the individual or entity that offers the Work under the terms of this License.
  • "Original Author" means the individual or entity who created the Work.
  • "Work" means the copyrightable work of authorship offered under the terms of this License.
  • "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
  • "License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.

2. Fair Use Rights

Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws.

3. License Grant

Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:

  • to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works;
  • to create and reproduce Derivative Works;
  • to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works;
  • to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works.
  • For the avoidance of doubt, where the work is a musical composition:
    • Performance Royalties Under Blanket Licenses. Licensor waives the exclusive right to collect, whether individually or via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital performance (e.g. webcast) of the Work.
    • Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right to collect, whether individually or via a music rights society or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions).
    • Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).


The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved.

4. Restrictions

The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:

  • You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by clause 4(c), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by clause 4(c), as requested.
  • You may distribute, publicly display, publicly perform, or publicly digitally perform a Derivative Work only under the terms of this License, a later version of this License with the same License Elements as this License, or a Creative Commons iCommons license that contains the same License Elements as this License (e.g. Attribution-ShareAlike 2.5 Japan). You must include a copy of, or the Uniform Resource Identifier for, this License or other license specified in the previous sentence with every copy or phonorecord of each Derivative Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Derivative Works that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder, and You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Derivative Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Derivative Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Derivative Work itself to be made subject to the terms of this License.
  • If you distribute, publicly display, publicly perform, or publicly digitally perform the Work or any Derivative Works or Collective Works, You must keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). Such credit may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear where any other comparable authorship credit appears and in a manner at least as prominent as such other comparable authorship credit.

5. Representations, Warranties and Disclaimer

UNLESS OTHERWISE AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE MATERIALS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.

6. Limitation on Liability.

EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. Termination

  • This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works or Collective Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
  • Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.

8. Miscellaneous

  • Each time You distribute or publicly digitally perform the Work or a Collective Work, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
  • Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
  • If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
  • No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
  • This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.