Page 1 of 1

Manual Mesh LOD with static geometry?

Posted: Sat Mar 01, 2014 2:26 pm
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

Re: Manual Mesh LOD with static geometry?

Posted: Sat Mar 01, 2014 2:40 pm
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.

Re: Manual Mesh LOD with static geometry?

Posted: Sat Mar 01, 2014 3:04 pm
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

Re: Manual Mesh LOD with static geometry?

Posted: Sat Mar 01, 2014 3:53 pm
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.

Re: Manual Mesh LOD with static geometry?

Posted: Mon May 26, 2014 10:07 am
by nkligang
hi, I had the same question of using manual mesh LOD with static geometry. can somebody solute this problem? thx.

Re: Manual Mesh LOD with static geometry?

Posted: Wed May 28, 2014 2:04 pm
by tod
Try the paged geometry add-on and see if it's ok for you. It has LOD support AFAIK.