Impostors don't disappear when they should

Faxnico

18-11-2008 17:37:40

Hello.

First of all congratulations and sorry for my poor english.

I'm having some troubles in my project with the impostors that I never experienced playing the "Forest Demo".

It looks like they don't disappear at all when I come close to trees with the camera.

Here you've a picture of the problem:



I setup Paged Geometry, taken from SVN, as follow:

void CSimPagedGeometryManager::createPagedGeometry(const Forests::TBounds& stageBound, Ogre::Camera* camera)
{
m_PG = new Forests::PagedGeometry();
m_PG->setCamera(camera);
m_PG->setPageSize(250000);

m_PG->addDetailLevel<Forests::BatchPage> (9000, 3000);
m_PG->addDetailLevel<Forests::ImpostorPage> (70000, 5000);

m_PL = new Forests::TreeLoader2D(m_PG, stageBound);
m_PL->setHeightFunction(&CSimPagedGeometryManager::getTerrainHeight);
m_PL->setMaximumScale(10.0f);
m_PG->setPageLoader(m_PL);
}


Then I push trees using the loader's addTree method:

m_PL->addTree(
pgGrpInfos.m_Entities[idx],
pgGrpInfos.m_TerrOffset + (orientation * Ogre::Vector3(x, 0.0f, z)),
Ogre::Degree(Ogre::Math::UnitRandom()*360.0f),
Ogre::Math::RangeRandom(pgGrpInfos.m_ScaleRnd.x, pgGrpInfos.m_ScaleRnd.y));


And finally I update PG every frame in my loop:

void CSimPagedGeometryManager::update()
{
m_PG->update();
}


Any help would be extremly appreciated.

Thank you.
Nicolò

JohnJ

18-11-2008 18:18:48

Your page size (250,000) is way too large. Given your world unit scale, it should be set to around 1000 - 3000. I think the API documentation for setPageSize() explains why and how to set this value.

Currently it's putting all of your trees into a single page, which is not only bad for performance, but causes issues with LODs like this.

Also, your world scale seems unusually large - keep in mind that this might cause issues later on (especially with physics engines). Generally you should use 1 unit = 1 meter (or maybe 1 yard / foot). Otherwise you might encounter precision problems, etc.

Faxnico

23-11-2008 15:16:00

Thanks for your reply Jhon. At the end I followed your suggestions, rescaling the whole scene, etc... Bye.

Chaster

18-12-2008 07:42:20

I hate to resurrect this thread, but suddenly, I am having the same problem as the original poster, but I was not encountering this until recently. I have not changed any settings to batch page size or other options. I did update to the latest version in SVN a few days ago though, and I also changed tree models to something new (but that would strike me as an odd reason for the problem I'm encountering).

My terrain area is approximately 1km x 1km. I'm using detail levels of 150 (with 30 unit transition) for the batchpage, and 450 (with transition of 75) for the impostor page.

It's weird that it only happens for a few trees here and there, not all...

Update: after some experimentation, it seems that the error is related to pageSize. I have had it set at 128, but then I tried 80 and noticed a lot less of the trees had the "non-disappearing impostor" problem. Then I tried 300 for pageSize, and almost all the trees had the non-disappearing impostor problem. Finally, I tried 64 and it seemed like the problem was completely gone.

I understand that having a too large pageSize is a problem, but it seems to me that on a terrain which is 1025x1025 meters, a pageSize of 128 seems pretty reasonable... Is it not?

Any thoughts?

JohnJ

18-12-2008 15:36:59

Strange. I wonder if these new issues are related to Shaggoth in any way. Hmm. Well, I'll see if I can find what's causing this and (hopefully) fix it soon.