Using Mesh Level of Detail(LoD) within Ogre3d

For those who are not familiarized with the definition of LoD I might say that Level Of Details techniques is responsible for decreasing the complexity of a 3d object representation accordingly distance(the most usual way), camera position and/or eye-space speed.

Inside the graphical engine Ogre3d, the LoD is based on distance, actually the z distance from the mesh to the viewer camera, I'll write the code right down here, and then I'll explain each line. (Before using this method you have to generate a new and optimized
mesh file. Click here to see how you can use the optimize tool of 3dstudio max)

       MeshPtr mesh1 = MeshManager::getSingleton().load("animal.mesh",
              ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 
       mesh1->createManualLodLevel(250, "animallod2.mesh");
       mesh1->createManualLodLevel(500, "animallod3.mesh");

       Entity* animal = mSceneMgr->createEntity("animalMeshWithLod", mesh1->getName() );
       SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
       node->attachObject(animal);
In a first step we manually load a mesh file through the MeshManager and set it to a MeshPtr. The most important step: create the manualLodLevel through the method of the mesh class createManualLodLevel then we choose a depth value(the z distance that I told you before) and in a second parameter we tell which is the new mesh that ogre should show if the viewer camera reaches the z distance. Now we create an entity using this configured mesh file, and attach it to a SceneNode. compile it and you'll see the results. lod1 original size lod2 original size lod3 original size
Tags: 

Comments

Would you plz check the image link?
It seems that the image can't be loaded.
Many thanks.

And sorry for taking so long.

hi!

your images links are not working.

thanks!

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.