Table of Contents

Lab 2: Getting Meshes and Materials into Ogre 3D

Required Tools

What to Do in this Lab

The Procedure

  1. Go to your personal Ogre application folder (where the executable for your own Ogre application sits) and do the following:
    • Create a new sub-folder called Models
    • Add the line FileSystem=Models in the Popular section of your application's resources.cfg (This tells your application that it should search for named resources in this folder)
  2. Create a model in Blender (even just use the default cube you get when you start up Blender)
    • There is a lot of good resources on Blender modeling, including the Official Getting Started tutorials
    • It is a good idea to save your model in the Blender file format early and often
    • Pay attention to what you name your geometry, this becomes the name of the exported mesh
  3. Export the model using the Blender2Ogre exporter and save it in your Models folder
    • Make sure that any texture imported, baked or generated is saved as a file in the same folder
  4. Run the OgreXMLConverter command line tool on the exported XML mesh file to turn it into a binary Ogre mesh file
  5. Create an Entity in your Ogre application from the mesh you just exported
    • In C++ it would look like this:
        Ogre::Entity* mycube = mSceneMgr->createEntity("MyCube", "MyCubeMesh.mesh");
        Ogre::SceneNode* cubeNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
        cubeNode->attachObject(mycube);
	cubeNode->setScale(50,10,50); // You may have to scale your object to see it well
  1. Make sure you see your object when you run your application!

What to Try

Here are things you should now play with:

    myCube->setMaterialName("BlueMaterial");