Rotating objects for a loong time warps the scaling (floating point issue).
-
- Gremlin
- Posts: 180
- Joined: Tue Nov 25, 2008 10:58 am
- Location: Kristiansand, Norway
- x 23
Rotating objects for a loong time warps the scaling (floating point issue).
Rotating objects for a long time warps the scaling (floating point issue), happens in 1.9 and newer.
If you for example take the HDR sample with rotating cubes, run it for a long time (over night is best) then the object
is wobbly and scale gets messed up, warping the mesh when rotating.
If I remember correctly it happens because the transformations are never normalized\reset, is it that way because of performance?
Anyways - it causes issues with software that runs for a long time (simulators for example).
If you for example take the HDR sample with rotating cubes, run it for a long time (over night is best) then the object
is wobbly and scale gets messed up, warping the mesh when rotating.
If I remember correctly it happens because the transformations are never normalized\reset, is it that way because of performance?
Anyways - it causes issues with software that runs for a long time (simulators for example).
-
- OGRE Expert User
- Posts: 1227
- Joined: Thu Dec 11, 2008 7:56 pm
- Location: Bristol, UK
- x 157
Re: Rotating objects for a loong time warps the scaling (floating point issue).
Cant offer any answers but I have had this exact issue, it causes some amusing things to happen in my sims!
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: Rotating objects for a loong time warps the scaling (floating point issue).
When you say HDR sample, you mean 2.1's sample?
Edit: Oh my God, Node::rotate does not renormalize, this behavior could totally happen.
This issue for example would be hidden if rotate() is called after some call to setOrientation(). It would only show up after enough successive calls to rotate().
But of course, that's no excuse for us to ship poor quality code
Since al2950 seems to also have seen this behavior, I am pushing it a fix. Performance is nothing if the routine is unreliable.
Edit 2: Fix pushed. Thanks for the report!
Btw the error was easily reproducible on the sample by modifying it:
Without the fix, the cubes get all giant and wonky (shear). After the fix they remain correct.
Edit: Oh my God, Node::rotate does not renormalize, this behavior could totally happen.
That's correct.
I don't know. It could be that, or it could be because of a simple oversight, or underestimating the effect over time.
This issue for example would be hidden if rotate() is called after some call to setOrientation(). It would only show up after enough successive calls to rotate().
As a general guideline, if the simulation is mission critical, I always suggest to do the math yourself to guarantee the stability of the math. Particularly setting quaternion/position/scale externally. As an extreme example, that's why NASA is extremely strict on third party code.
But of course, that's no excuse for us to ship poor quality code
Since al2950 seems to also have seen this behavior, I am pushing it a fix. Performance is nothing if the routine is unreliable.
Edit 2: Fix pushed. Thanks for the report!
Btw the error was easily reproducible on the sample by modifying it:
Code: Select all
static long repeat = 10000000;
if( mAnimateObjects )
{
for( int j=0; j<repeat; ++j )
{
for( int i=0; i<16; ++i )
mSceneNode[i]->yaw( Ogre::Radian(timeSinceLast * i * 0.125f) );
//timeSinceLast += 0.1;
}
}
if( repeat != 1 && timeSinceLast > 8.0 / 1000.0 )
repeat = 1;
-
- Gremlin
- Posts: 180
- Joined: Tue Nov 25, 2008 10:58 am
- Location: Kristiansand, Norway
- x 23
Re: Rotating objects for a loong time warps the scaling (floating point issue).
Thank you for the quick fix!
-
- OGRE Team Member
- Posts: 2087
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1127
Re: Rotating objects for a loong time warps the scaling (floating point issue).
this was fixed in 1.10 two years ago:
https://github.com/OGRECave/ogre/commit ... 7c07d0dbae
we should work out a way to share more code between 1.x and 2.x
https://github.com/OGRECave/ogre/commit ... 7c07d0dbae
we should work out a way to share more code between 1.x and 2.x
-
- OGRE Team Member
- Posts: 5429
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1337
Re: Rotating objects for a loong time warps the scaling (floating point issue).
I agree. With a few exceptions, I'd like to merge your CMake changes (specially iOS stuff), as well as the Ogre Config dialog changes.