[solved]out of memory vertex buffer

madmarx

22-04-2009 13:00:00

Hi,

(solved : see end)

I am using paged geometry. I got 1 mesh, with 4 submeshes.
The whole is 4500 polys.
When I am using only impostor, everything is fine.
When I am using also batch page, it works until a certain point, where I got an ogre exception

12:41:20: Creating resource group BinFolder
12:41:20: Added resource location '.' of type 'FileSystem' to resource group 'BinFolder'
12:41:20: OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource Impostor.NTPEVZEBLWWGTNRHERRHFTGVQKYGOERX.1024.dds in resource group BinFolder or any other group. in ResourceGroupManager::openResource at ..\src\OgreResourceGroupManager.cpp (line 753)
12:41:21: Texture: Impostor.NTPEVZEBLWWGTNRHERRHFTGVQKYGOERX.1024.png: Loading 1 faces(PF_A8R8G8B8,4096x4096x1) with 12 generated mipmaps from Image. Internal format is PF_A8R8G8B8,4096x4096x1.
12:41:51: OGRE EXCEPTION(7:InternalErrorException): Index Buffer: Out of memory in GLHardwareIndexBuffer::lock at ..\src\OgreGLHardwareIndexBuffer.cpp (line 122)

Clearly the memory error happens after a little walk in my scene. Note about my scene : there is only a row of 25000 tree.

I suppose:
that batch pages informations are stored in RAM, and then send/calculated on demand to the GPU memory.
I also suppose that : When a batchpage is not visible anymore (too away...), it seems it is not unloaded from GPU memory.

I am right or wrong?
What are your advice?
If I can tweak something in pagedgeometry to force the unload of the batchpage, where do I do it, so that I don't run out of memory again?

more about the scene (this is ultra basic):

Forests::PagedGeometry *trees = new Forests::PagedGeometry();
trees->setCamera(lCamera);
trees->setPageSize(50);
trees->setInfinite();
trees->addDetailLevel<Forests::BatchPage>(75, 0);
//trees->addDetailLevel<FakeGeometryPage>(100,0);
Forests::GeometryPageManager * imposteurs = trees->addDetailLevel<Forests::ImpostorPage>(5000, 0);
//imposteurs->setNearRange(100.0);
Forests::ImpostorPage::setImpostorResolution(1024);//4096*2048

//Create a new TreeLoader3D object first
Forests::TreeLoader3D *treeLoader = new Forests::TreeLoader3D(trees, Forests::TBounds(-1500, -1500, 1500, 1500));


for(unsigned int i = 0; i<25000 ; i++)
{
Ogre::Vector3 lPositionEntity;
lPositionEntity.x = i;
double scale = 1;
Ogre::Vector3 lScaleEntity(scale,scale,scale);


EDIT : it where my bounds of my scene that were littler than my scene. :D btw excellent plugin.

JohnJ

17-05-2009 13:33:10

The error indicates that your video card is simply out of memory. Note that PagedGeometry improves performance of tree rendering at the expense of video memory as it duplicates the definition of trees over and over to reduce draw calls. This also means though that PagedGeometry isn't a very good choice for tree models with lots of triangles.

To avoid this problem, you can try:
- Use a less detailed tree mesh
- Reduce the draw distance of BatchPage geometry, as it seems to be too much for your video card
- Set the page size to a smaller value, in combination with reducing draw distance of BatchPage
- Get a graphics card with more memory :)