Manual Mesh LOD with static geometry?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Manual Mesh LOD with static geometry?

Post by AshMcConnell »

Hi Folks,

It's been a while since I've been doing anything serious with Ogre, so I'm a bit rusty :)

My artist is trying to do manual LOD with my racing track. I use StaticGeometry to attempt to reduce the number of batches. Unfortunately when he adds manual mesh LOD to one of the track objects I get an assertion failure: -

Code: Select all

assert(qmesh->geometryLodList->size() == lodLevels);
Here is the method in question for some context: -

Code: Select all

void StaticGeometry::Region::assign(QueuedSubMesh* qmesh)
	{
		mQueuedSubMeshes.push_back(qmesh);

        // Set/check lod strategy
        const LodStrategy *lodStrategy = qmesh->submesh->parent->getLodStrategy();
        if (mLodStrategy == 0)
        {
            mLodStrategy = lodStrategy;

            // First LOD mandatory, and always from base lod value
            mLodValues.push_back(mLodStrategy->getBaseValue());
        }
        else
        {
            if (mLodStrategy != lodStrategy)
                OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Lod strategies do not match",
                    "StaticGeometry::Region::assign");
        }

		// update lod values
		ushort lodLevels = qmesh->submesh->parent->getNumLodLevels();
		assert(qmesh->geometryLodList->size() == lodLevels);

		while(mLodValues.size() < lodLevels)
		{
			mLodValues.push_back(0.0f);
		}
		// Make sure LOD levels are max of all at the requested level
		for (ushort lod = 1; lod < lodLevels; ++lod)
		{
			const MeshLodUsage& meshLod =
				qmesh->submesh->parent->getLodLevel(lod);
			mLodValues[lod] = std::max(mLodValues[lod],
				meshLod.value);
		}

		// update bounds
		// Transform world bounds relative to our centre
		AxisAlignedBox localBounds(
			qmesh->worldBounds.getMinimum() - mCentre,
			qmesh->worldBounds.getMaximum() - mCentre);
		mAABB.merge(localBounds);
		mBoundingRadius = Math::boundingRadiusFromAABB(mAABB);

	}
Is it possible to do manual mesh LOD with StaticGeometry? If so, any idea what could be going wrong here?

Thanks for your help.
All the best,
Ash
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Manual Mesh LOD with static geometry?

Post by c6burns »

AFAIK manual LOD is not supported with StaticGeometry. You should have critical warnings in your log to this effect for each entity you added which has manual LOD.
User avatar
AshMcConnell
Silver Sponsor
Silver Sponsor
Posts: 605
Joined: Fri Dec 14, 2007 11:44 am
Location: Northern Ireland
x 16
Contact:

Re: Manual Mesh LOD with static geometry?

Post by AshMcConnell »

Thanks c6burns,

Ah so it does :(. I'm getting: -

Code: Select all

12:04:33: WARNING (StaticGeometry): Manual LOD is not supported. Using only highest LOD level for mesh bel_tyre_wall_red02.mesh
Strange that automatic LOD is supported, but not manual. The new automatic LOD system does look rather awesome though. Are there any other sensible options to get LOD and also good batching?

Thanks for your help,
Ash
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Manual Mesh LOD with static geometry?

Post by c6burns »

I'm not very familiar with StaticGeometry yet, I just remembered trying to do exactly this and noticing it is not supported. I have a slightly customized PagedGeometry implementation for my current project which just does some fairly simple vegetation batching and billboarding. I don't use manual LODs since I was happy with swapping to billboard at a distance.
nkligang
Kobold
Posts: 35
Joined: Wed Aug 18, 2010 9:14 am

Re: Manual Mesh LOD with static geometry?

Post by nkligang »

hi, I had the same question of using manual mesh LOD with static geometry. can somebody solute this problem? thx.
User avatar
tod
Troll
Posts: 1394
Joined: Wed Aug 02, 2006 9:41 am
Location: Bucharest
x 94
Contact:

Re: Manual Mesh LOD with static geometry?

Post by tod »

Try the paged geometry add-on and see if it's ok for you. It has LOD support AFAIK.
Post Reply