Bones - Skeletal and Pose animations for jPCT

Started by raft, January 06, 2010, 11:45:01 PM

Previous topic - Next topic

raft

done. latest updates are in official (whatever it means ;)) version now..

stillw

Hi raft,

Can you give a newb some advice pls? My question is really to check with you that I understand what I need to do correctly, so I'm not headed down a blind alley.

Summarising: I am making a 3D animated app for the first time. I realised that I need to give it an armature and use that to move it and so started learning Blender. Then I came across your (frankly) amazing work, and I really think it's the way for me to go. So, I believe I have to now either export Blender models to Ogre or just start anew with Ogre and learn how to do the animation there. Then I'll need to learn JPCT and Bones... so a bit of work for me to do... that's ok, part of the fun, eh!?

Here's what I'm mostly doubtful about: My app will involve a figure moving in time (movements are pre-determined steps) to a beat, and the user will have the ability to vary that beat. I'm imagining that the best way is for me to build my animations in Ogre and load them through Bones and then play them back (I hope) at a speed that corresponds to the beat, (slower/faster). Is it possible to vary the speed of a pre-loaded animation? If not I may have to do it all programatically...

In the future the user may even be able create new steps for the movements, this which could be either by stitching together parts of steps from pre-built animations, or purely programmed, or even by building into my app some kind of interface to Ogre animation... Perhaps you have some ideas about that, but if you feel that this affects how I should be working out the immediate issues I have, please let me know!

Thanks so much for your time, and any help you can lend :)
stillw


raft

hi stillw,

Quote
So, I believe I have to now either export Blender models to Ogre or just start anew with Ogre and learn how to do the animation there. Then I'll need to learn JPCT and Bones... so a bit of work for me to do... that's ok, part of the fun, eh!?
basicly true. but an important note, Ogre is not a 3D editor like Blender. it's a 3D engine like jPCT. you dont need to learn it but need some tool which can export to its format (which bones can load). there are many ogre exporters for many 3D tools including blender. but someone tried blender ogre exporter in the past (see the previous pages in this thread) and it turned out exporter is faulty. at least for that specific model and animation. maybe it works for you but no guarantees..

if you somehow have access to 3ds Max, i suggest OgreMax plugin for max. i found it quite successful.

QuoteIs it possible to vary the speed of a pre-loaded animation? If not I may have to do it all programatically...
sure. in deed there is no such thing in Bones (and also in jPCT) to play animation in pre-canned speed. but it's quite simple to do. all you need to do is calculate an index in [0-1] range which maps to a time in an animation sequence. see: Animated3D.animateSkin(index, sequence) have a look at the samples in Bones, you can change the speed with a slider.

QuoteIn the future the user may even be able create new steps for the movements, this which could be either by stitching together parts of steps from pre-built animations, or purely programmed, or even by building into my app some kind of interface to Ogre animation... Perhaps you have some ideas about that, but if you feel that this affects how I should be working out the immediate issues I have, please let me know!
both are possible. you can programatically merge animation segments into a new one or virtually merge them (ie: they are not really merged but played one after another to give that felling). you can also create animations programatically from scratch. you dont need to worry about this for now, once other parts are done this wont be hard to add..

QuoteThanks so much for your time, and any help you can lend :)
np, hope this helps ;)

r a f t

stillw

Truly excellent news... I'm getting excited about this now :)

Thanks again, and also for the tip on using Ogre... I installed it on my Ubuntu/Linux system and couldn't find it to run (ie. looking for a gui), but after what you said, now that makes more sense!

Yes, I did read all of the posts in this thread before (actually >1 time). I'm aware I may run into the order of bones problem, but it seems easy enough to sort... and my skeleton is really going to be simple and (hopefully) not updated often, it will be the animations that might get changed.

cheers
stillw

raft

Quote from: stillw on September 20, 2010, 11:00:14 PM
I'm aware I may run into the order of bones problem, but it seems easy enough to sort... and my skeleton is really going to be simple and (hopefully) not updated often, it will be the animations that might get changed.
actually the ordering of bones is not a problem anymore. they can be in any order now. the problem i had mentioned is another one. it isnt mentioned in this thread but this one.

stillw

Oh, I didn't read that one! Mmm...

I have to travel for a few weeks, during this time I'll get to try out the animations (this is all learning from scratch). When I come back I'll see how this all goes and what options I have. I am not heavily invested in Blender, just that it's the only 3D modelling tool I've used, and I've been through several tutorials with it. Free is best right now... I'm really in proof of concept kinda stage :)

ty Raft!

Mr.Marbles

Raft, thanks for the great ports of the Ogre & Collada loaders!

I've actually been using the Ogre loader for some time in jME and I had all my meshes organized into scene files which was supported by the loader. I noticed your API doesn't support scenes. Do you have any intentions on supporting them?

raft

Quote from: Mr.Marbles on September 28, 2010, 12:24:38 AM
I noticed your API doesn't support scenes. Do you have any intentions on supporting them?

not really. my primary purpose was an animation library. but porting them from an existing loader wont be that hard, why not create another project yourself ;)

Mr.Marbles

Quote from: raft on September 28, 2010, 12:50:30 AM
... porting them from an existing loader wont be that hard, why not create another project yourself ;)

If I have time I will definitely look into that.

I have another question, about the Collada loader. I was scratching my head trying to figure out why all my previously working textures didn't map properly until I compared your Seymour texture to the original one in Ardor3D. Also the "_flipped.png" in the texture name hinted something as well  :) I'm just curious as to why the textures need to be vertically flipped from their original positions in order to get them to load properly.

raft

Quote from: Mr.Marbles on September 29, 2010, 12:28:55 AM
I have another question, about the Collada loader. I was scratching my head trying to figure out why all my previously working textures didn't map properly until I compared your Seymour texture to the original one in Ardor3D. Also the "_flipped.png" in the texture name hinted something as well  :) I'm just curious as to why the textures need to be vertically flipped from their original positions in order to get them to load properly.
well, that's a good question and i'm not sure i have the correct answer ;)

seymour's original texture is in TGA format and Ardor flips TGA textures vertically while loading. so i assumed flipped one is correct and later forgot the matter. what is the format of your textures? how did you export your models? you said you were using JME loader, possibly it shares same loader code with Ardor and maybe flipping your textures too.

i'm not sure which behaviour is correct here ??? i can sure flip UV's while loading but not sure if that fits all cases. AFAIK Ardor passes UV's to OpenGL as they are and jPCT does the same. so the UV's should be correct IMHO

please have a look at the posts below:
http://ardor3d.com/forums/viewtopic.php?f=10&t=501&p=3712#p3712
http://www.jpct.net/forum2/index.php/topic,1490.0.html

sorry for the trouble ::)

Mr.Marbles

Quote from: raft on September 29, 2010, 01:07:58 AM
seymour's original texture is in TGA format and Ardor flips TGA textures vertically while loading. so i assumed flipped one is correct and later forgot the matter. what is the format of your textures? how did you export your models? you said you were using JME loader, possibly it shares same loader code with Ardor and maybe flipping your textures too.

My textures are in jpg format. I used jME for Ogre models and Ardor3D for Collada models. In both cases I never needed to flip the textures, but I did need to flip them to have them work with your Bones lib. This seemed strange to me since Bones is using the Ardor3D Collada loader (although it's probably an older version).

I'll take a look at the links you posted. Thanks.

Mr.Marbles

Quote from: raft on September 29, 2010, 01:07:58 AM
please have a look at the posts below:
http://ardor3d.com/forums/viewtopic.php?f=10&t=501&p=3712#p3712
http://www.jpct.net/forum2/index.php/topic,1490.0.html

So it appears Ardor3D Collada loader is programmatically flipping the textures when the models are loaded. I noticed that in the jPCT Seymour example you use:

ColladaImporter colladaImporter = new ColladaImporter().loadTextures(false);
...
Texture texture = new Texture("./samples/data/seymour/seymour_flipped.png");
TextureManager.getInstance().addTexture("seymour", texture);

for (Animated3D o : skinnedGroup) {
    o.setTexture("seymour");
    o.build();
    o.discardMeshData();
}


And in the Ardor3D example the textures are loaded automatically by the ColladaImporter:

final ColladaImporter colladaImporter = new ColladaImporter();

// Load the collada scene
final ColladaStorage storage = colladaImporter.load(source);


So maybe we could avoid the manual texture flipping if Bones ColladaImporter would use the built-in texture flipping of Ardor3D. Just a guess  :-\

raft

Quote from: Mr.Marbles on September 29, 2010, 04:40:59 PM
So maybe we could avoid the manual texture flipping if Bones ColladaImporter would use the built-in texture flipping of Ardor3D. Just a guess  :-\
if i got you correctly, this is irrelevant. Bones does not use texture information from Ardor's Collada loader in any way. only the UV's are used.

i've got another look into Ardor's loader code. seems as it flips all Collada textures. this may be because of Collada UV's are flipped compared to OpenGL's. if this is the case, i can flip UV's while loading. i googled for this but couldnt find anything yet. also i wonder, if this is the case, why not Ardor flip UV's instead of textures ???

raft

#73
i couldn't find something official but according to this post Collada's V's is flipped compared to OpenGL. so flipping V's while loading seems to be the best choice.

please try the flipped version below:
<removed>

edit: removed the obsolute link