SkillAgentSearch skills...

Blender2ogre

Blender exporter for the OGRE 3D engine

Install / Use

/learn @OGRECave/Blender2ogre
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

blender2ogre

This versions requires Blender 2.8+. For Blender 2.7x: use the 2.7x-support branch

Index

Installing

  1. Copy the io_ogre folder into the $BLENDER_DIR/scripts/addons folder.
  2. Enable the addon in Blender: Edit menu > Preferences > Add-ons. Search for 'ogre' and click the box up the top left.
  3. Configure the plugin before the first run.
    • Set the correct path to OGRETOOLS_XML_CONVERTER
      • for Ogre (v1): path should point to OgreXMLConverter.exe. This can be found in the Ogre SDK
      • for OgreNext (v2): path should point to OgreMeshTool.exe. This can be found in the OgreNext SDK
    • OPTIONAL Set MESH_PREVIEWER to a path pointed to ogre-meshviewer.bat. This can be found in OGRECave/ogre-meshviewer
    • Make sure that USER_MATERIALS isn't set to a directory like "C:\". The addon scans this path recursively and will crash when it hits a path it doesn't have permissions for.

NOTE: Installing Blender using Ubuntu Snap package or Fedora Flatpak will lead to the following error: cp: cannot create directory '/snap/blender/3132/3.4/scripts/addons/io_ogre': Read-only file system (see: Installing on Ubuntu 20.04 and Blender 3.4.1. #169)

There are two possible solutions:

  • After downloading the blender2ogre repo, uncompress it somwhere and then compress the io_ogre folder as a .zip file. Go to Edit -> Preferences (CTRL-ALT-U) -> Add-ons -> Install... and then select the file io_ogre.zip
  • Copy the io_ogre folder into the folder: ~/.config/blender/3.4/scripts/addons/ (where 3.4 is the Blender version)

Updating to new versions

If you are upgrading from a previous version of blender2ogre and having problems, you may want to delete your old .json config file from $BLENDER_DIR/config/scripts/io_ogre.json and restart blender.

Video Tutorials

Exporting Meshes

To export a blender model: File Menu > Export > Ogre3D (.scene & .mesh).

If the menu button is greyed out (or you get this error: RuntimeError: Operator bpy.ops.ogre.export.poll() failed, context is incorrect), then make sure there is an active object selection in the blender Node tree (Scene collections) first. The active object selection is when there is an object with a yellow outline (in contrast to the orange outline of the passive selected objects)

  • If you have OGRETOOLS_XML_CONVERTER set to "OgreXMLConverter.exe" path, then the export dialogue will display options relevant to the Ogre (v1) mesh format.
  • If you have OGRETOOLS_XML_CONVERTER set to "OgreMeshTool.exe" path, then the export dialogue will display options relevant to the OgreNext (v2) mesh format.

Check out all the exporter and importer options in the Options Document

Materials

Materials will be exported as OGRE 1.x material files or as OGRE Next material.json files as required.

OGRE 1.x Materials

Materials are exported as RTSS OGRE 1.x materials (unless "Fixed Function Parameters" is selected). The following textures are exported: Base Color, Metallic and Roughness, Normal Map and Emission. Baked Ambient Occlusion is not supported for the moment.

Your material will be best exported if you follow the GLTF2 guidelines: glTF 2.0 - Exported Materials. Except for the Emission texture, where the Emission input of the Principled BSDF node is used as the Emission texture.

A good example of how the material should be setup for best results is the "Damaged Helmet" model found here: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/DamagedHelmet

OGRE Next JSON Materials

The current OGRE Next JSON exporter only explicitly supports a metalness workflow, however it will attempt to export materials not following that workflow regardless and may produce passable results.

For materials using metalness it expects a single image with the blue channel containing the metalness map and the green channel containing the roughness map fed into the Principled BSDF via a Separate RGB node. Not following this convention will print a warning to the console and the exported materials will likely not appear correctly when rendered.

There are numerous features in the Ogre Next JSON format that are not directly supported, see the Materials JSON notes for details.

Blender Modifiers Support

Blender has some very useful modifiers, and most of them are supported by blender2ogre but not all of them. Check out the Blender Modifiers Support Page to check out the list and also some recommendations about them.

Mesh triangulation issues

Cube with broken shading

If you are seeing some issues with the mesh triangulation (like visible triangles in your shading), check the Mesh Triangulation README to learn more about the subject and how to work around it.

OgreNext tips

If you do want to export in the OgreNext (v2.) format, make sure in the Export dialogue > General Settings > Mesh Export Version is set to V2. The following parameters are a good starting point to get a model exported to an Ogre mesh:

  • General
    • Mesh export version: v2
  • Materials
    • Export materials: ticked
  • Armature
    • Armature animation: ticked
  • Mesh
    • Export mesh: ticked
    • Edge lists: un-ticked
    • If your model's materials contain normal mapping:
      • Tangents: "generate with parity"
      • Else Tangents: "none"
    • Optimise Vertex buffers for shaders: ticked
    • Vertex buffer options: puqs

You can check the arguments passed to OgreMeshTool.exe in the Blender console. (Window Menu > Toggle System Console)

Blender will export the material format in an Ogre (V1) format. This is not compatible with OgreNext (V2.*). You should manually convert them to a material.json file. See the Ogre Wiki: HLMS Materials for more information.

Importing Meshes

As of blender2ogre version 0.8.2, the Kenshi Importer has been integrated into blender2ogre with the following features:

  • Import mesh from .xml as well as .mesh files
  • Import whole .scene files (as of version 0.8.5) with all its objects
  • Option to be able to merge imported submeshes or keep them separate
  • Parsing/Conversion of materials into Blender (just create a Principled BSDF material and add a texture with the proper UV mapping)
  • Importing of Poses
  • Importing of Skeletons works for the most part, but Ogre skeletons conventions are not like Blenders (see: How to get bone's vector and bone's length?)
  • Importing of Animations work, but depends on the skeleton which sometimes doesn't get correctly imported
  • As of Blender 4.1+, it is now possible to drag and drop files of types: .xml, .mesh or .scene and import them automatically. (https://docs.blender.org/api/4.1/bpy.types.FileHandler.html)

NOTE: Orientation of the imported mesh is assumed to be xz-y (Ogre default), the blender2ogre Axis Swapping option does not work for the importing process.

Additional Features

Merge Objects on export

You might have hundreds of objects, which you want to keep separate but have them in one .mesh on export. For this create a new collection (M) named merge.<yourname>. The output will be a single <yourname>.mesh file. Alternatively link the collection.

NOTE: The origin of the resulting merged object will be that of the last object you added to the collection (although when reloading the blend file, this order will be lost). To have control over the precise location of where the merged objects' origin will

View on GitHub
GitHub Stars241
CategoryDevelopment
Updated15d ago
Forks75

Languages

Python

Security Score

100/100

Audited on Mar 15, 2026

No findings