Animation does not play Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Animation does not play

Post by golgobot »

Unfortunately I cannot upload a .fbx or .dae file since those extensions are not allow as attachments.

But I have a very simple cube with a single bone. It plays a simple animation that translates, scales, and rotates the cube.

I'm using https://github.com/OGRECave/ogre-assimp to convert an fbx to .mesh, .material, and .skeleton files.

The converter seems to do its job just fine and produces all three files: cube.mesh, cube.material, cube.skeleton.

In my application I load the mesh and enable the animation

Code: Select all

    _anim_node = _sphere_node->createChildSceneNode();
    _anim_entity = _scene_manager->createEntity("cube", "cube.mesh");
    _anim_state = _anim_entity->getAnimationState("Take 001");
    _anim_state->setEnabled(true);
    _anim_state->setLoop(true);
    _anim_node->attachObject(_anim_entity);
Then in my update function I add time to the animation

Code: Select all

if(_anim_state) {
    _anim_state->addTime(1 / 60);
}
I get no errors. My cube happily displays and I can see it, but it's not animating at all. I've triple checked that addTime is being called. The cube animates in Maya, I can preview the FBX in other programs, but it just won't animate in Ogre.

One last question how do I get Ogre:: SkeletonSerializer to write out a .skeleton.xml so I can inspect the skeleton file? That might help debug this.
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

To sanity check, I also tried loading penguin.mesh (from the Samples) and playing the "amuse" animation. Same result. The penguin displays properly, there are no errors, but the penguin does not move at all.

I'm so confused and just want to be unblocked on this.
dbtx
Halfling
Posts: 66
Joined: Tue Nov 01, 2011 9:07 pm
x 10

Re: Animation does not play

Post by dbtx »

Hello,
Is that the integer division it looks like? 1/60 is 0...
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

Good catch, but I don't think this was it! Changed it to

Code: Select all

if(_anim_state) {
    _anim_state->addTime(0.015f);
    cout << _anim_state->getTimePosition() << endl;
}
And had the same results. This prints the correct times with looping:

Code: Select all

6.34499
6.35999
6.37499
6.38999
6.40499
6.41999
6.43499
6.44999
6.46499
6.47999
6.49499
6.50999
6.52499
6.53999
6.55499
6.56999
6.58499
6.59999
6.61499
6.62999
6.64499
6.65999
0.00831842
0.0233184
0.0383184
0.0533184
0.0683184
0.0833184
0.0983184
0.113318
0.128318
0.143318
0.158318
0.173318
0.188318
0.203318
0.218318
0.233318
0.248318
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

My only thought is that I'm not using OgreRoot::startRendering. I'm rendering the viewport to an FBO and then rendering that as a texture in an other graphics library.

Is there an update function I need to call somewhere to actually process the joints and move the animation forward? When I add a FrameListener to the OgreRoot I don't get any callbacks. Could this be the root cause of the animations not showing up properly?

What's also strange is that I can set the position of an item manually and it will actually visually update.
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

Would really love to get unblocked on this. Looking into it further it looks like my entity has the enabled AnimateState in memory, everything looks like it should. It's just not animating.

Is there a list of paid consultants who can help on issues like this? What kind of support does this engine have? I tried emailing the webmaster, but I got a "failed to send to recipient" error message back. Is this project even active?

Thanks
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: Animation does not play

Post by xrgo »

golgobot wrote:My only thought is that I'm not using OgreRoot::startRendering. I'm rendering the viewport to an FBO and then rendering that as a texture in an other graphics library.

Is there an update function I need to call somewhere to actually process the joints and move the animation forward? When I add a FrameListener to the OgreRoot I don't get any callbacks. Could this be the root cause of the animations not showing up properly?
that seems to be the problem, you have to call

Code: Select all

    Ogre::Root::getSingleton().renderOneFrame();
in a loop somewhere, to actually render stuffs, in fact I am not sure how you can see the object at all... adding that all the registered FrameListener should also get executed (frameStarted, frameRenderingQueue, and FrameEnded)
golgobot wrote:Is there a list of paid consultants who can help on issues like this?
I have no idea, I bet there might be
golgobot wrote:What kind of support does this engine have?
Community!!
golgobot wrote:I tried emailing the webmaster, but I got a "failed to send to recipient" error message back
mmmm that's critical, should be fixed!
golgobot wrote:Is this project even active?
yes! very much! but some of us are moving to version 2.1 that its staring to differ in many aspects from 1.X

Sadly/Happily this is an open project so there are only few maintainers but many expert users, that don't always have the time to respond when the question/answer is not evident to them. My advice is that you put more code, maybe some images or video, that tend to call more attention =D. and don't give up! Ogre is amazing =D
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

OMG thank you! That worked!

I agree, Ogre is great! I'm going to stick to 1.10 for now since it's a stable release.

How far along do you think 2.x is relative to being production ready?
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: Animation does not play

Post by xrgo »

golgobot wrote:How far along do you think 2.x is relative to being production ready?
it is production stable! my team, and many others, are already using it for production (we do simulation and have many costumers using our simulators with no problem), you'll get performance and graphics quality boost out of the box.
The problem is... that is not feature stable.
With this I mean there are non or very rare bugs, but once in a while there are some API breaking changes, but usually get announced at the forums and get sticky for a few weeks... and it takes (in my experience) between 5 minutes to 2 hours to understand and integrate the changes in to your framework. So for me that's hasn't been a problem at all.
And the second problem is that not all of the old documentation works, so you have to rely mainly on the samples and the 2.0+ subforums, but if the problem is hard.. dark_sylinc (aka Matias, the Ogre 2.1/2 main maintainer) usually answers fast.
IMHO go with 2.1 :twisted:
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

Ok, thanks for the update.

Back to the original problem, turns out this call, Ogre::Root::getSingleton().renderOneFrame();, breaks the rendering of the rest of my application for some reason. Basically it prevents Qt from rendering random characters in menu items and UI. It's the strangest thing and I'm so close to giving up.

Does Ogre 2.x support the type of rendering I'm doing? That is rendering to an FBO and rendering that as a texture to a QtQuickScene.
golgobot
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 11:26 pm

Re: Animation does not play

Post by golgobot »

So figured out what was going on! I was manually calling the Ogre::RenderTexture::update AND calling renderOneFrame. This was obviously causing issues. Removing the update function call fixed it.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: Animation does not play

Post by xrgo »

Awesome!!!!!!!
I render to textures all the time, and I use Qt as my window manager, I render Ogre in to a QWindow that I can put anywhere as any widget. But I have no idea about QtQuickScene
Post Reply