Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by decapitb, 14 years ago) (diff)

Exporting Objects From Blender To Orxonox

Checked with Blender 2.49b on 6. Mar. 2010 by beni?

This page explains how to export 3D models from Blender and view them in a Level in Orxonox.

mesh Files

Ogre understands only the Ogre-specific .mesh files, so we have to export our objects from Blender to a .mesh file. A .mesh file is a binary file, that contains one single mesh (object).

Prerequisites

To export to mesh we first need the 'Blender Exporter' and the 'Ogre Command-line Tools'. Get them from the Ogre Tools Download Page. For Blender 2.49b, you will need to have Python installed on your system, version 2.5.2 or higher. If you use Linux, you will most probably already have Python installed.

Blender Exporter

If a system wide installation is intended, unpack the zip archive you downloaded from the Ogre webpage into /usr/share/blender/scripts. If only a local installation in required or possible (probably due to the lack of permissions), unpack it somewhere in your home dir, ~/.blender/scripts/ is suggested.

Note: On the Tardis computers of D-ITET, the Blender Mesh Exporter is already installed.

Note 2: The manual for the OGRE Meshes Exporter can be found here.

Command-line Tools

Download and extract to any location you want, just remember where. With Windows it should usually extract automatically to C:\OgreCommandLineTools

Exporting to mesh

No image "export.png" attached to BlenderExport

  1. Make sure your model reaches the general guidelines for a mesh.
  2. Check if all textures for your objects are loaded into Blender.
  3. Make sure your materials don't still have the generic name ('Material', 'Material.001', …), otherwise Orxonox might not choose the correct material for your model.
  4. It is very helpful, to name your objects and data blocks if you have not done so already (see picture).
  5. Open the export dialog (File → Export → OGRE Meshes). If this option doesn't show up, update the menus (Scripts Windows → Scripts → Update Menus). If it still doesn't show up, make sure you have installed the script correctly and you have python installed. Verify in the User Preferences Window under File Paths, that the path to Python scripts is correct.
  6. Select the model. Hit Preferences and provide the Path to the Ogre Command-line Tools (e.g. C:\OgreCommandLineTools), return to the main window. Check "OgreXML Converter", uncheck "Copy Textures", if your texture resides in the same folder as your blend file. Pick a sensible filename for your material under Material Settings.
  7. Hit Export.

This will create (at least) 4 new files in the blend-file-folder: a .mesh file, a .mesh.xml file, and a .material file. Most likely, a log file of the OgreXML Converter will be produced also. Ignore it for now.

The material filename will be the one you chose in the export dialog. This file contains all materials that are used in your scene, so if you export several meshes from the same scene (blend-file), you will only need one material file.

The name of the two mesh files will be the one you picked in the material window (see picture). The .mesh.xml file is a XML file containing the data of your object. Because you checked "OgreXML Converter", the XML file was directly converted to the binary mesh file, which we need to load the model into the game.

To Orxonox

  1. Copy the .mesh file to …/data_extern/models
  2. Copy the .material file to …/data_extern/materials/scripts
  3. Copy any texture files to …/data_extern/materials/textures
  4. Goto trunk/data/levels and open any level file (empty_level.oxw is always a good choice for tests) and insert:
    <?lua ... >
    <Level ...>
    <Scene ...>
    ...
    <Model mesh="yourModel.mesh" position="0,0,0" />
    ...
    </Scene>
    </Level>