Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 8 (modified by FelixSchulthess, 16 years ago) (diff)

Object Export with Blender

This page explains how to export 3D models from Blender to load them 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 Mesh Exporter, a python plugin for Blender. Get it from the Ogre webpage. To use this plugin, python must be installed on your system.

If a system wide installation is intended, unpack the zip file into /usr/share/blender/scripts. If only a local installation in required or possible (probably due to the lack of permissions), unpack them somewhere in your home dir, ~/.blender/scripts/ is suggested. Then adapt the script path in Blender (User Preferences → File Paths → Python). Don't forget to save your default settings (Ctrl+U), so you don't have to do this every time you start Blender.

Exporting to mesh

  1. Check if all textures for your objects are loaded into Blender.
  2. It is very helpful, to name your objects and data blocks if you have not done so already (see picture).
  3. 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.
  4. Select the model, 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.
  5. Hit Export.

This will create (at least) 3 new files in the blend-file-folder: a .mesh file, a .mesh.xml file, and a .material file.

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.

This is an outdated page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

obj Files

  1. Delete all unused Materials
  2. Load the correct texture files for your meshes into blender (jpg or png)
  3. Select all objects you want to export. Don't forget the mountpoints of your spaceship!
  4. Export the the Blender scene as an Object file (File → Export → Wavefront (obj))

Now you should have two new files: a *.obj and a *.mtl file. The OBJ file contains all you meshes and texture coordinates. The MTL file contains all material (texture) related data. These files can be edited with any good text editor.

Problems

  • If your model is transparent in the engine (but shouldn't) you have to flatten you texture file in GIMP before exporting as png or jpg. That deletes the alpha channel, which is not needed anyway.

Attachments (1)

Download all attachments as: .zip