SOLVED Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

The blender2ogre 0.5.8 version has the same problem and it does 0-1 on camera fov attribute instead of 35 or some degrees as previously.
The value changes if chenged in blender, but the problem is how to calculate back from 0.2378735823 or similar to 35 degrees or such.
So it is not necessarily wrong if I could calculate back from decimal number to degrees.
I would however prefer to degrees directly and suspect this to be a bug.
The spot inner outer values are still 0-1 as well.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by jacmoe »

If the values are in radian then it's no problem to convert them to degrees - it's built right into Ogre math. :)
However, if the values are wrongly computed, it needs to be fixed.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

Here are some example settings for a spot.
Blender -> DotScene
45 degrees -> outer="0.7853981852531433" inner="0.6675884527838338"
30 degrees -> outer="0.5235987901687622" inner="0.4450589685225559"
80 degrees -> outer="1.3962633609771729" inner="1.1868238485082188"

For camera fov it is similar.

I suspect this can be converted somehow for spot and camera with the right calculation.
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 220

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by scrawl »

It's quite obvious that the exported (DotScene) values are the same value, but in radians. So, for the conversion, just multiply the value by (180 / PI)
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by jacmoe »

/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

It was not quite obvious to me...

I did as jacmoe suggested and changed my code to setspotlightrange(Radian(inner), Radian(Outer), Falloff)
Similar for my camera fov.

I however still get the axisaligned error.
I will try to debug a bit more and see if I can trace the problem.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I have come a bit closer I think to detecting the problem with this.
I do not think it is my movement vectors.

This line seems to cause problems:
SceneManager1->setShadowTextureSettings( 1024, 1, PF_FLOAT32_RGBA );
SceneManager1->setShadowTextureSettings( 1024, 10, PF_FLOAT32_RGBA );

When it is set higher than 2 crashes are frequent but with 2 or 1 it does not crash.

I have tested with 2 spots, 1 directional and 1 point present, so I would assume that it should be possible to have it set to 4, since there are 4 lights.

But can multiple lights cast shadows on a material when it is only set to 1 or does the count in setShadowTextureSettings need to match number of lights?
Any other suggestions to why I get axis aligned error when changing the texture count?
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I am still getting this error and it is quite annoying with constant crashes.

I have debugged it a bit more, but still can not find out what I am doing wrong.
I am only doing basic stuff so I do not understand what is causing it.

But I think the problem has something to do with focused shadow camera setup.

When I enable these lines I get the crash:
ShadowCameraSetupPtr mCurrentShadowCameraSetup = ShadowCameraSetupPtr( new FocusedShadowCameraSetup() );
SceneManager1->setShadowCameraSetup( mCurrentShadowCameraSetup );

When I do
LiSPSMShadowCameraSetup* mLiSPSMSetup = new LiSPSMShadowCameraSetup();
ShadowCameraSetupPtr mCurrentShadowCameraSetup = ShadowCameraSetupPtr( mLiSPSMSetup );
SceneManager1->setShadowCameraSetup( mCurrentShadowCameraSetup );

.. or just have no camera setup I can move around the camera fine without crashes.
So I am thinking that it is not any of my movement vectors, but something with focused shadow camera setup.

Does anybody have any suggestions how to eliminate this bug???
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by Kojack »

Without actually having the project to try debugging ourselves there's probably not much that hasn't been suggested already.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I fiddled around a bit more and I think I have located it, but do not know why this cause a crash.

I load dotscene file with light, meshes and similar.
Every time I enable this line in my importer the crash occurs...

SceneManager1->getLight( LightName )->setDirection( Ogre::Vector3::NEGATIVE_UNIT_Y );

I create a scenenode for the light and set scale orientation position for the scenenode like this...
SceneManager1->getSceneNode( NodeName )->setScale( NodeScaX, NodeScaY, NodeScaZ );
SceneManager1->getSceneNode( NodeName )->setOrientation( NodeOrientW, NodeOrientX, NodeOrientY, NodeOrientZ );
SceneManager1->getSceneNode( NodeName )->setPosition( NodePosX, NodePosY, NodePosZ );

Any ideas why I am not able to do setdirection for my spotlight?
User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ
x 69

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by areay »

I had a problem like this a little while ago. This is a good forum post on the subject http://www.ogre3d.org/forums/viewtopic.php?f=3&t=40634

Anyway, in my case I was doing something like this

Code: Select all

Ogre::Quaternion q = /* make the quaternion somehow */
Ogre::Radian amountToYaw = q.getYaw();
mySceneNode->yaw(amountToYaw);
And was intermittently getting the dreaded "AABB min must be less than max" assertion crash. Turns out that sometimes getYaw() (and I imagine the other quaternion helper functions like getPitch() & getRoll() too) will return a NaN! My suggestion to you is to do an Ogre::Math::isNan() check on any value that you use to rotate/yaw/pitch/roll a scenenode/camera and then print out a message (or assert() whatever) if this situation occurs. If you detect the problem then you can work your way around it too. Hope this helps.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I will try to examine what you write and see if I can use this.

But I just think it is a bit strange.

I have a plane and a camera and a spot, very basic stuff, done like in examples.

When I do set direction negative z for my spot the crash occurs.
And I do not even move the spot or anything.
Only translate the camera and very soon it crashes.

If I disable setdirection for the spot I can move pitch yaw and roll the camera fine.

Also when I use anything other than texture additive integrated and focused shadow camera setup together I can enable setdirection negative z for the spot.

I just find it very strange that it seems to be related to the spot when I am not moving the spot around only the camera.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I looked a bit in that thread you linked to and it just confirms my belief that my spot, focused shadow camera setup and texture additive integrated is somehow broken.

The setdirection for my spot is not the problem sine I got it to crash when changing angles and fov.

I guess I will go back and try to debug again. I think it is some thing with angles and camera fov.

I just think it is a bit annoying that when simply creating a spot and a camera this error occurs.

Thanks for linking to thread, though.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I suspect it is something with the camera, since that is what I move and in the linked thread there is something about focusedshadowcamerasetup.

Maybe somebody could test this and see if they also get error when the camera is moved around.

Code: Select all

Light* SpotLight1 = SceneManager1->createLight("SpotLight1");
SpotLight1->setType(Light::LT_SPOTLIGHT);
SpotLight1->setDiffuseColour(1.0, 1.0, 1.0);
SpotLight1->setSpecularColour(1.0, 1.0, 1.0);
SpotLight1->setDirection(Ogre::Vector3::NEGATIVE_UNIT_Z);
SpotLight1->setSpotlightRange(Ogre::Degree(35), Ogre::Degree(50));
SceneNode* SpotLight1Node = SceneManager1->getRootSceneNode()->createChildSceneNode("SpotLight1Node");
SpotLight1Node->attachObject(SpotLight1);
SpotLight1Node->setPosition(Ogre::Vector3(-20, 0, 100));

SceneNode* TestNode = SceneManager1->getRootSceneNode()->createChildSceneNode("TestPlane");
Entity* TestEntity;
Plane TestPlane = Plane(Ogre::Vector3::UNIT_Z, 0);
MeshManager::getSingleton().createPlane("TestPlane", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,TestPlane,2000, 2000, 100, 100, true, 1, 1, 1, Ogre::Vector3::UNIT_Z.perpendicular());
TestEntity = SceneManager1->createEntity( "TestPlane", "TestPlane" );
TestEntity->setMaterialName( "TestMaterial1" );
TestNode->attachObject(TestEntity);
TestNode->setPosition( 0, 0, -100 );

Camera* Camera1 = SceneManager1->createCamera( "Camera1" );
Camera1->setDirection( Ogre::Vector3::NEGATIVE_UNIT_Z );
SceneManager1->getRootSceneNode()->createChildSceneNode( "Camera1" );
SceneManager1->getSceneNode( "Camera1" )->attachObject( Camera1 );
It is real simple, just a camera a plane and a spotlight.
And texture additive integrated / focused shadow camera setup.

The linked thread also mentions something about debug mode. But If someone just could try and see if it works for them when the camera is moved around and rotated.
Mine crashes instantly when I move the camera.
Last edited by OGREHEAD on Mon May 20, 2013 3:05 pm, edited 1 time in total.
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

I just set up the basic ogre framework from tutorial and created a plane, spot and camera like this:

Code: Select all

Light* SpotLight1 = SceneManager1->createLight("SpotLight1");
SpotLight1->setType(Light::LT_SPOTLIGHT);
SpotLight1->setDiffuseColour(1.0, 1.0, 1.0);
SpotLight1->setSpecularColour(1.0, 1.0, 1.0);
SpotLight1->setDirection(Ogre::Vector3::NEGATIVE_UNIT_Z);
SpotLight1->setSpotlightRange(Ogre::Degree(35), Ogre::Degree(50));
SceneNode* SpotLight1Node = SceneManager1->getRootSceneNode()->createChildSceneNode("SpotLight1Node");
SpotLight1Node->attachObject(SpotLight1);
SpotLight1Node->setPosition(Ogre::Vector3(-20, 0, 100));

SceneNode* TestNode = SceneManager1->getRootSceneNode()->createChildSceneNode("TestPlane");
Entity* TestEntity;
Plane TestPlane = Plane(Ogre::Vector3::UNIT_Z, 0);
MeshManager::getSingleton().createPlane("TestPlane", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,TestPlane,2000, 2000, 100, 100, true, 1, 1, 1, Ogre::Vector3::UNIT_Z.perpendicular());
TestEntity = SceneManager1->createEntity( "TestPlane", "TestPlane" );
TestEntity->setMaterialName( "TestMaterial1" );
TestNode->attachObject(TestEntity);
TestNode->setPosition( 0, 0, -100 );

Camera* Camera1 = SceneManager1->createCamera( "Camera1" );
Camera1->setDirection( Ogre::Vector3::NEGATIVE_UNIT_Z );
SceneManager1->getRootSceneNode()->createChildSceneNode( "Camera1" );
SceneManager1->getSceneNode( "Camera1" )->attachObject( Camera1 );
And it still crashes, so I think there is some kind of bug in ogre, unless I am creating plane, spot or camera wrong.
I think the linked thread has something to do with the error and hopefully someone can fix this:
http://www.ogre3d.org/forums/viewtopic.php?f=3&t=40634

I found another link discussing it:
https://forum.openmw.org/viewtopic.php?f=8&t=552
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by Kojack »

I just tried that code, no problems for me.
You've mentioned shadows. Could you give the exact shadow setup code as well?
(if the test above was without shadows, then that's very odd)
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by syedhs »

Sometimes,strange errors can be attributed to mismatched DLL/lib - check using Depends utility.. make sure all exe and dlls looked correct (no red icon).
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
OGREHEAD
Goblin
Posts: 260
Joined: Tue Feb 02, 2010 6:25 pm
x 2

Re: Error - OgreAxisAlignedBox.h:252 - OGRE CRASHES

Post by OGREHEAD »

Thanks for testing and helping out.
I think, I found the problem.

First of all I installed new os...
And in my project I deleted cache and removed some of the linked files.

And I can now run the project without crashes.

So it seems that it was related to bad linking or such.
And when you have tested my code Kojack I guess the code is fine and it was not caused by my objects.

So for now it looks good.