I've been using Ogre since 1.6, currently on 1.10, and I was always fighting the culling system since I have my own custom lighting and shadowing system, and a custom zone-based culling system.
What I generally do is set a really huge bounding box for everything so that Ogre always thinks everything is in the frustum. For instance, on manually created meshes, I always do the following.
Code: Select all
m_pDynamicSpotMesh->_setBounds(AxisAlignedBox(-1000000,-1000000,-1000000,1000000,1000000,1000000));
m_pDynamicSpotMesh->_setBoundingSphereRadius(1000000);
For Ogre::Rectangle2D I always use
Code: Select all
miniScreen_VR_L->setBoundingBox(AxisAlignedBox(-100000.0*Vector3::UNIT_SCALE, 100000.0*Vector3::UNIT_SCALE));
I had a problem with manually created banks of general purpose triangles (used dynamically every frame for doing blood splats and such) culling, so when I initially create the triangle bank, I set the first 8 triangles to be at the far corners of a massive cube like this, where SPLAT_BANKDISTANCE is 32767 and all my action happens well within the bounds of the cube that creates.
Code: Select all
for(nLoop=0 ; nLoop<MAXDYNAMICSPOT ; nLoop++)
{
// Ogre is incorrectly culling stuff after I modify the mesh, regardless of how I set the bounding boxes.
// to get around this 8 of the triangles are set to the extreme corners of a massive bounding box.
// the rest of the triangles are just put in a line off in the distance.
switch(nLoop)
{
case 0: flXPosA= SPLAT_BANKDISTANCE ; flYPosA= SPLAT_BANKDISTANCE ; flZPosA= SPLAT_BANKDISTANCE ; break ;
case 1: flXPosA=-SPLAT_BANKDISTANCE ; flYPosA= SPLAT_BANKDISTANCE ; flZPosA= SPLAT_BANKDISTANCE ; break ;
case 2: flXPosA= SPLAT_BANKDISTANCE ; flYPosA=-SPLAT_BANKDISTANCE ; flZPosA= SPLAT_BANKDISTANCE ; break ;
case 3: flXPosA=-SPLAT_BANKDISTANCE ; flYPosA=-SPLAT_BANKDISTANCE ; flZPosA= SPLAT_BANKDISTANCE ; break ;
case 4: flXPosA= SPLAT_BANKDISTANCE ; flYPosA= SPLAT_BANKDISTANCE ; flZPosA=-SPLAT_BANKDISTANCE ; break ;
case 5: flXPosA=-SPLAT_BANKDISTANCE ; flYPosA= SPLAT_BANKDISTANCE ; flZPosA=-SPLAT_BANKDISTANCE ; break ;
case 6: flXPosA= SPLAT_BANKDISTANCE ; flYPosA=-SPLAT_BANKDISTANCE ; flZPosA=-SPLAT_BANKDISTANCE ; break ;
case 7: flXPosA=-SPLAT_BANKDISTANCE ; flYPosA=-SPLAT_BANKDISTANCE ; flZPosA=-SPLAT_BANKDISTANCE ; break ;
default:
//flXPosA=nXPos ; flYPosA=-SPLAT_BANKDISTANCE ; flZPosA=0 ;
flXPosA=nXPos ; flYPosA=0 ; flZPosA=0 ;
}
Note that this only had to be done on the initial creation, after that I was free to move any of the triangles anywhere and they still wouldn't be culled.
For entities, I do the following
Code: Select all
aabb.setExtents(-SPLAT_BANKDISTANCE, -SPLAT_BANKDISTANCE, -SPLAT_BANKDISTANCE, SPLAT_BANKDISTANCE, SPLAT_BANKDISTANCE, SPLAT_BANKDISTANCE) ;
m_pEntityInfo[nEntity].pEnt->getMesh()->_setBounds(aabb,false);
I have found the above tricks work for circumventing Ogre culling. But I did find it frustrating that there was no easy way just to turn it off.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.