Manual LOD Ogre 1.10

Problems building or running the engine, queries about how to use features etc.
Post Reply
Anthea
Kobold
Posts: 25
Joined: Tue Oct 28, 2014 1:03 pm

Manual LOD Ogre 1.10

Post by Anthea »

I want to create manual LOD for my Manual Object. Older Posts suggest to use mesh->createManualLODLevel(..). I can't find this function anymore. There is only a updateManualLODLevel(..) but it's not working if there isn't any LOD defined. How is this solved in Ogre 1.10?

Thanks in advance!
Last edited by Anthea on Thu Aug 13, 2015 1:46 pm, edited 1 time in total.
Anthea
Kobold
Posts: 25
Joined: Tue Oct 28, 2014 1:03 pm

Re: Manual LOD Ogre 1.9

Post by Anthea »

still urgent for me. Actually this should not be any problem(?)!

I found this method for 1.9: createManualLodLevel (Real value, const String &meshName, const String &groupName=Ogre::String())
but it's not there for 1.10. What is the equivalent??
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

Re: Manual LOD Ogre 1.10

Post by dark_sylinc »

There was a GSoC that improved LOD autogeneration, and also allowing mixing manual LODs with auto-generated LODs instead of being all or nothing.
Mesh::_setLodUsage, there is a MeshLodUsage::manualName member that controls this behavior.

Though it may be a lot safer to use the Lod generator interface:

Code: Select all

MeshLodGenerator gen;
LodConfig lodConfig(mesh, PixelCountLodStrategy::getSingletonPtr());
lodConfig.advanced.useBackgroundQueue = false; // Non-threaded
lodConfig.createGeneratedLodLevel(0.0f, 0.0f); //First level, auto-gen
lodConfig.createManualLodLevel( distance, "mesh_name" ); //2nd level, manual
lodConfig.createGeneratedLodLevel( distance1, 0.5f ); //3rd level, autogen
lodConfig.createManualLodLevel( distance3, "mesh_name2" ); //4th level, manual again
MeshLodGenerator().generateLodLevels(lodConfig);
You may also be interested in checking out gen.getAutoconfig. This data, included manual mesh names, gets saved to the 1.10 mesh format.
Anthea
Kobold
Posts: 25
Joined: Tue Oct 28, 2014 1:03 pm

Re: Manual LOD Ogre 1.10

Post by Anthea »

Thanks for your help! Nevertheless It's not working out of the box for me. The LOD mesh is not visible. I tested it with a absolute different mesh for the LOD, but only my main mesh is visible. I also tested different distances.

my code:

Code: Select all

new Ogre::MeshLodGenerator(); //called once at system initialisation

Ogre::MeshPtr mesh = mManualObject->convertToMesh(nameOfMesh, "General");
Ogre::LodConfig config(mesh);
config.createManualLodLevel(distance, "myLODMesh.mesh");
config.advanced.useBackgroundQueue = false; //also tested with true
Ogre::MeshLodGenerator::getSingleton().generateLodLevels(config);
Ogre::Entity* ent1 = OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity(nameOfEntity, nameOfMesh);
mNode->attachObject(ent1);

with debugger I can verify that
mesh->getNumLodLevels() = 2
mesh->hasManualLodLevel() = true

with a distance of 0 the LOD is visible. With any other value, it's not visible. Could it be that somehow the distance-calculation is broken in my setup?
//lodConfig.createGeneratedLodLevel(0.0f, 0.0f); //First level, auto-gen
auto-gen as you propose does not work, I always get a runtime exception. This does not occure for every mesh, but once in a while and I can't find the specific reason. In debug mode I receive this msg:

Code: Select all

Assertion failed: (data->mTriangleList.capacity() > data->mTriangleList.size()) && (""), file A:\Anthea\Ogre\OgreSDK_vc12_x64_v1-9-0unstable\Component
s\MeshLodGenerator\include\OgreLodInputProviderBuffer.h, line 70
Do i need to tell Ogre that I use manual LODs ? Is there something wrong with my ManualObjects? Since I generate them procedurally I can't say atm for sure that the mesh is okey.
Post Reply