Author Topic: How to Animate Face and Body Simultaneously  (Read 4113 times)

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
How to Animate Face and Body Simultaneously
« on: August 26, 2011, 07:27:21 pm »
I have a one-part model of a human. His idle animation loops constantly. When you talk, he is going to repeat what you say, hopefully without interrupting the idle animation. I guess my two questions are: is it at all possible on jPCT with a one-part model and do the OgreMax exporter and jMe importer (and, for that matter, Raft's Bones's animation) support this?

The only thing of which I could think is that I could save several copies of the idle animation doing numerous things with his face and skip around between them (but it wouldn't look perfect--because I couldn't always land on the exact same frame of the idle animation--and it would result in a larger-than-hopefully-necessary file size).

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Animate Face and Body Simultaneously
« Reply #1 on: August 27, 2011, 12:12:01 am »
yes that is possible with single model. skeletal and pose animations can be blended. animate body with skeletal animation and face with pose animation. also have a look at animation blend demo.

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #2 on: August 27, 2011, 05:43:22 am »
Thank you very much, Raft, for pointing me in the right direction. Now, what editor do you usually use? What do you usually use to export the ogre.model.xmls?
« Last Edit: August 27, 2011, 08:00:06 am by AGP »

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #3 on: August 27, 2011, 10:07:57 am »
All of the meshes I exported with OgreMesh (ranging from 1.2k poly models to 20k) have crashed with the same message:
[ Sat Aug 27 05:00:19 GMT 2011 ] - ERROR: Can't retrieve object #0!
Exception in thread "main" java.lang.NullPointerException


Any insight into the problem would be extremely appreciated. By the way, OgreMax exports to versions 1.7 and 1.8 of Ogre. I've tried both with the same results.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Animate Face and Body Simultaneously
« Reply #4 on: August 27, 2011, 11:19:10 am »
I use 3dsMax and OgreMax and never experienced problems. can you also post the stack trace?

I'm in holiday now. I will be back at the end of next week

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #5 on: August 27, 2011, 11:31:33 pm »
No problem:
Information: Child "AndersonMesh000" attached to this node "Anderson"
Problem loading file: No controller found in OgreEntityNode. Means there is no skeleton or pose animation!
[ Sat Aug 27 18:27:16 GMT 2011 ] - ERROR: Can't retrieve object #0!
Exception in thread "main" java.lang.NullPointerException
        at OgreLoader.<init>(OgreLoader.java:69)
        at OgreLoader.main(OgreLoader.java:310)

Line 69 is as follows:
Code: [Select]
SimpleVector cameraPosition = theWorld.getObject(0).getTransformedCenter();
But since getObject(0) is null, it's crashing. Are there any special settings (other, naturally, than to set it to .xml) to which you set OgreMax? Thanks in advance!

Update: It seems that so far I have two choices: get a million printouts of "Warning: rotation axis not normalized" and it exports the .skeleton.xml along with the .mesh.xml (but still crashes with the above message). Or do OgreMax>Normalize Mesh Scaling, not get those messages, but not get a .skeleton.xml file either. And just to make it clear: neither way works for loading these models.
« Last Edit: August 28, 2011, 07:21:24 am by AGP »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Animate Face and Body Simultaneously
« Reply #6 on: August 28, 2011, 09:10:36 pm »
well, the log is quite descriptive: there is no animation in exported file. play with exporter options.

nevermind about rotation axis warnings. jME checks if length of vector is exactly one and prints that warning. due to rounding issues most of the time it's not exactly one.

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #7 on: August 28, 2011, 09:26:55 pm »
The exporter is set to export animations and the xml file has, if nothing else, thousands of pose lines. By the way, I have no problem importing any of your files (the ninja and that cylinder, for two).
« Last Edit: August 28, 2011, 09:36:27 pm by AGP »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Animate Face and Body Simultaneously
« Reply #8 on: August 28, 2011, 09:32:37 pm »
that's strange. send me the file but I can look at it earliest this weekend. meanwhile you can debug it ;)

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #9 on: August 28, 2011, 09:39:01 pm »
I can do that. But again, I'm having no trouble importing your own models. I just got the latest OgreMax (2.3.15 or so) version and during installation most recently selected Ogre version 1.8. Do you suppose either of these choices could be the problem?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Animate Face and Body Simultaneously
« Reply #10 on: August 28, 2011, 09:49:28 pm »
maybe but I don't think so. can you open exported file in OgreMax's viewer and see animation there?

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #11 on: August 28, 2011, 09:52:28 pm »
The OgreMax viewer as far as I could tell only opens binary files, not the XML ones. I'll export to binary and report back in a sec.

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #12 on: August 28, 2011, 10:02:04 pm »
That was a useful test, thank you. Indeed, the binary .mesh isn't moving in the OgreMax WinViewer (still it loads on WinViewer, which is better than crashing). But my model is animated and OgreMax is set to export the animation, so that's very odd. Are you willing to post all your scene, object, and global settings so we could compare notes and we could put it in the wiki for future reference?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1971
    • View Profile
    • http://www.aptalkarga.com
Re: How to Animate Face and Body Simultaneously
« Reply #13 on: August 28, 2011, 10:09:54 pm »
I can do that but there was nothing fancy.

for crashing, Bones is an animation library. it's not a scene loader, so I think that behaviour is correct  ;)

Offline AGP

  • quad
  • ******
  • Posts: 1525
    • View Profile
Re: How to Animate Face and Body Simultaneously
« Reply #14 on: August 29, 2011, 08:45:46 am »
Hey, I knew it would be a rookie thing: I didn't know you had to do OgreMax>Object Settings>Mesh Animations ADD and specify the frames you wanted to export. My settings were such that a box was checked for "export animation" I hadn't specified what was my animation. This should definitely go into the wiki to prevent future newbies from wasting a day on it.