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.
original size
original size
original size
Comments
Image loading failed..
Would you plz check the image link?
It seems that the image can't be loaded.
Many thanks.
checked
And sorry for taking so long.
images
hi!
your images links are not working.
thanks!
Add new comment