| 1 | = Exporting Objects From Blender To Orxonox = |
| 2 | |
| 3 | ''Checked with Blender 2.49b on 6. Mar. 2010 by [wiki:Deca beni]'' |
| 4 | |
| 5 | This page explains how to export 3D models from Blender and view them in a Level in Orxonox. |
| 6 | |
| 7 | == mesh Files == |
| 8 | |
| 9 | 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). |
| 10 | |
| 11 | === Prerequisites === |
| 12 | |
| 13 | To export to mesh we first need the 'Blender Exporter' and the 'Ogre Command-line Tools'. Get them from the [http://www.ogre3d.org/download/tools 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. |
| 14 | |
| 15 | ==== Blender Exporter ==== |
| 16 | |
| 17 | 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. |
| 18 | |
| 19 | '''Note:''' On the Tardis computers of D-ITET, the Blender Mesh Exporter is already installed. |
| 20 | |
| 21 | '''Note 2:''' The manual for the OGRE Meshes Exporter can be found [http://www.cs.ucr.edu/~macchiea/cs134/lab1/ogrehelp/ogremeshesexporter.html here]. |
| 22 | |
| 23 | |
| 24 | ==== Command-line Tools ==== |
| 25 | |
| 26 | Download and extract to any location you want, just remember where. With Windows it should usually extract automatically to C:\OgreCommandLineTools |
| 27 | |
| 28 | === Exporting to mesh === |
| 29 | |
| 30 | [[Image(wiki:BlenderExport:export.png, right)]] |
| 31 | 1. Make sure your model reaches the [wiki:Guidelines general guidelines for a mesh]. |
| 32 | 1. Check if all textures for your objects are loaded into Blender. |
| 33 | 1. 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. |
| 34 | 1. It is very helpful, to name your objects and data blocks if you have not done so already (see picture). |
| 35 | 1. 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. |
| 36 | 1. 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. |
| 37 | 1. Hit Export. |
| 38 | |
| 39 | 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. |
| 40 | |
| 41 | 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. |
| 42 | |
| 43 | 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. |
| 44 | |
| 45 | === To Orxonox === |
| 46 | |
| 47 | 1. Copy the .mesh file to .../data_extern/models |
| 48 | 1. Copy the .material file to .../data_extern/materials/scripts |
| 49 | 1. Copy any texture files to .../data_extern/materials/textures |
| 50 | 1. Goto trunk/data/levels and open any level file (empty_level.oxw is always a good choice for tests) and insert: |
| 51 | {{{ |
| 52 | <?lua ... > |
| 53 | <Level ...> |
| 54 | <Scene ...> |
| 55 | ... |
| 56 | <Model mesh="yourModel.mesh" position="0,0,0" /> |
| 57 | ... |
| 58 | </Scene> |
| 59 | </Level> |
| 60 | }}} |