Version 4 (modified by isusmelj, 11 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
- Make sure your model reaches the general guidelines for a mesh.
- Check if all textures for your objects are loaded into Blender.
- 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.
- It is very helpful, to name your objects and data blocks if you have not done so already (see picture).
- 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.
- 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.
- 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.
Check if the new created .mesh file is version 1.41 or 1.40 (open it with gedit or any editor and have a look at the first lines). If your exported mesh has 1.41 you have to export the .xml file by yourself using the following steps:
- Download and extract the OgreXMLConverter from here
- Copy the .mesh file from the previous exported Mesh (exported from Blender) into the OgreXMlConverter folder
- Use the following command to create a 1.40 version mesh
wine OgreXMLConverter yourmesh.xml
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
- Copy the .mesh file to …/data_extern/models
- Copy the .material file to …/data_extern/materials
- Copy any texture files to …/data_extern/images/textures
- 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>
- Make sure you have respected the Guidelines?