Synchronization and rendering update in OgreNewt ??

kikosmalltalk

06-05-2008 04:19:35

Hi everyone

I have a question for OgreNewt wrapper.

Does Ogre use interpolation for the rendering?

I can't find the use of the interpolation in the code!!.

Newton update code:

bool BasicFrameListener::frameStarted(const Ogre::FrameEvent &evt)
{
m_elapsed += evt.timeSinceLastFrame;
Ogre::LogManager::getSingleton().logMessage(" Newton Frame Listener... m_elapsed: "+Ogre::StringConverter::toString(m_elapsed)+
" m_update:"+Ogre::StringConverter::toString(m_update));

int count = 0;

if ((m_elapsed > m_update) && (m_elapsed < (1.0f)) )
{
while (m_elapsed > m_update)
{
m_World->update( m_update );
m_elapsed -= m_update;
count++;
}
}
else
{
if (m_elapsed < (m_update))
{
// not enough time has passed this loop, so ignore for now.
}
else
{
m_World->update( m_elapsed );
count++;
m_elapsed = 0.0f; // reset the elapsed time so we don't become "eternally behind".
}
}


My code is very similar and I need the interpolation for rendering.

Look this article: http://www.gaffer.org/game-physics/fix-your-timestep/

If ogreNewt doesn't use interpolation. How does it solve the stuttering problem?
I'm looking any topic, but I can't find anything useful.
advance thank you

kiko

PD: I should explain that at the moment I don't use Ogre

Beauty

06-05-2008 15:47:24

I'm new with OgreNewt and was reading much in the last days.

EDIT: grey text was wrong information
Maybe there is something wrong in your code.
You call m_World->update() many times (in a while loop).
If I understood right the manual, you just need to set the update value one time. It is the timestep, when Newton calculates the current state (independent from rendered frame). You can try a smaller value for world update.

The synchronization of your Ogre Scene with the Newton World will be done by a FrameListener (or somehow like that).


Here is the description of World->Update():
www.runehunter.phpnet.us/NewtonHelpCode ... wtonUpdate

The full manual is here:
www.runehunter.phpnet.us/NewtonHelp.html

Maybe also this wiki page helps:
www.ogre3d.org/wiki/index.php/Newton_Game_Dynamics

kikosmalltalk

13-05-2008 02:37:10

Hi Beauty

This code is not mine. This code is of walaber . Author of OgreNewt.

If you reads the article that I said, you can see that the code this in it lines with the walaber implementation. Except because walaber doesn't use interpolation. Apparently.

Walaber. Are you there is?

Please help !!!.

I use Genesis3D, not Ogre for the moment.
The problem of synchronization and rendering update, is common for any system of rendering.


KIKO.

Beauty

21-05-2008 11:51:56

My first reply was wrong.

With m_World->update(time) you tell Newton, how much time is passed (in physical world) since last calculation by update() call.

If you need to calculate the physics e.g. 100 times per second the second, the time param is 0.01.
If you render just 20 fps the walaber code would call 5x update() for each frameStarted.

I hope you understand what I mean.

walaber

26-05-2008 14:34:25

no, OgreNewt has no built-in code for interpolation between results.

you would need to implement that on your own.

Beauty

26-05-2008 14:57:28

To me it's looking so, that the shown code does interpolate
(if the fps rate is smaller than it's needed for the physics).