Bones - Skeletal and Pose animations for jPCT

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

Previous topic - Next topic

Mr.Marbles

Just hit another issue, I can't get my static, non-animated, collada models to load with Bones. They work fine in Ardor3D. Seems like Bones needs to have an AnimatedGroup in order to load the model in the World. Is this the only way to get a Collada import into jPCT?

raft

cool ;D i've made that the offical release.

for static models, that's right, you cannot load such models via Bones. this is an animation library afterall. AFAIK there is no Collada loader for jPCT. but you have the options to export them to 3ds or obj format which offer more functionality for such objects. for example there is no way to load multi textured objects via Bones at the moment.

shadow

Hi,

I try to use Bones for the first time and all the examples work alright! Now I'm trying to get my own model running...
I created a figure in Blender, made some very simple animation with it and explorted it to an Ogre Mesh. Then I modified the OgreSample.java from the samples to load my own model. The frame opens but I cannot see my model at all. Do you have an idea why? Can it have something to do with the "Rotation axis not normalized" warnings? This is the console output:


Java version is: 1.6.0_21
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
26.10.2010 22:33:28 com.jme.scene.Node <init>
INFO: Node created.
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNUNG: Rotation axis not normalized
26.10.2010 22:33:28 com.jme.scene.Node attachChild
INFO: Child "CubeMesh000" attached to this node "Cube"
-- total 17 joint(s) --
0 name: Bone, parent:
1 name: Bone.001, parent: 0:Bone
2 name: Bone.004, parent: 0:Bone
3 name: Bone.007, parent: 0:Bone
4 name: Bone.011, parent: 3:Bone.007
5 name: Bone.014, parent: 3:Bone.007
6 name: Bone.008, parent: 3:Bone.007
7 name: Bone.002, parent: 1:Bone.001
8 name: Bone.005, parent: 2:Bone.004
9 name: Bone.006, parent: 8:Bone.005
10 name: Bone.009, parent: 6:Bone.008
11 name: Bone.012, parent: 4:Bone.011
12 name: Bone.003, parent: 7:Bone.002
13 name: Bone.010, parent: 10:Bone.009
14 name: Bone.016, parent: 9:Bone.006
15 name: Bone.013, parent: 11:Bone.012
16 name: Bone.015, parent: 12:Bone.003
-- --
Skeleton created out of jME OGRE skeleton, 17 joints
Created skeleton animation clip: Action
Loading Texture..../data/models/jessica.png


Thanks very much in advance!
Stefan

raft

i've never experienced a problem related with those warnings. jME's ogre loader prints those warnings for all the models i tested.
can you see the joints or nothing at all? a screenshot may help

i've never used but another user reported Blender's Ogre exporter is faulty. have a look at this thread.

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

fireside

I've been looking around on this.  One suggestion is to select the mesh and then press cntrl-a before exporting.  Another is to make sure there is only one root bone in the skeleton.  Another is to make sure the path to the material is right in the material file.  If you do get this working, please post how you did it. 
click here->Fireside 7 Games<-

shadow

@raft

Heres a screenshot of my problem:



Unfortunately I see nothing at all, I tried to zoom in and out and rotate, nothing appears :(
BUT: My Animation (called "Action") is in the list. And also in my previous post you can see that the armature is recognized in the file
I do not have max, I definitely want to use Blender... now I updated to the latest exporter script.


@fireside

I applied scale and rotation data to object -> no effect :(
And my armature has only one root...
I'm not sure if it has something to do with the materials because I neither see polygons nor armature. But anyway what does this mean "the material is right in the material file" ?


Thanks for your support but so far I did not get it running. Maybe it helps if you see my files? I created an archive with blender and OGRE mesh files...
http://iluzio.de/models.zip


And another question:
If this does not work, I do not have to use bone animation, although it would be very cool. Do you know an easy way to get my animated models from Blender into JPCT?

fireside

#81
The material file has to have the right path, I guess.  I just read some things on the internet.  It's apparently a problem for different engines but people appear to be using it.  I might try to do some experimenting, but it would probably be better to just use some of my own models when I do.  I'm in the middle of trying to fix a bunch of code so I don't want to shift right now.

I use 3ds with Jpct.  You can just take snapshots of the model in different poses and use them for frames.  I use low poly models so it's no big deal, but this skeletal deal would still make the files even smaller if I could get it working.  I put a little section in the wiki about it for 3ds and Blender.

I found this guide for exporting to Ogre in Blender it was dated 2009:
conoroneill.comli.com/blenderexportguideforogre.pdf
click here->Fireside 7 Games<-

raft

Quote from: shadow
Thanks for your support but so far I did not get it running. Maybe it helps if you see my files? I created an archive with blender and OGRE mesh
boneassignments element is empty in mesh file. there should be vertexboneassignment elements in it which states joint weights over vertices. seems as blender ogre exporter somehow doesnt export those. without weights skeletal animation is not possible.

jME's ogre loader leaves weights as NaN values, as a result vertices are calculated as NaN which in turn results in autoAdjustCamera() method move camera to neverland.

comment the autoAdjustCamera(); in OgreSample.initialize() method and your skeleton will showup.


add the following lines to OgreSample and your model will showup.
       @Override
protected void update(long deltaTime) {
cameraController.placeCamera();
}

by doing this we are preventing skeleton pose to be applied to mesh.



as a conclusion, seems as this is blender ogre exporter's fault :(

raft

here ninja's texture is applied to your model, so it may look different.

shadow

#84
Yes, eeemm.... I forgot to add the right texture to the zip archive, but here I have it and it looks alright!

Thank you very much (!!) for figuring this out, but I really must say, I don't have any clue whats going on here...
With removing (or commenting) the autoAdjustCamera(); the skeleton is visible, and it is animated too! Thats cool so far...

But overriding the update() method it seems to me a lot of animation code is ommited. Why is the model rendered now because of this? And how did you find this out so fast :) ??


/EDIT:
If we could identify whats wrong with the export, maybe the ogre mesh script author could adjust his work....  May be an option.

raft

Quote
But overriding the update() method it seems to me a lot of animation code is ommited. Why is the model rendered now because of this?
right, by overriding the update() method we just omit animation code. animation code applies skeleton pose to mesh and in this case as necessary data is missing we got wrong results.

QuoteAnd how did you find this out so fast :) ?? 
by debugging and comparing your mesh file a correct one (ninja mesh) ;D

Quote
If we could identify whats wrong with the export, maybe the ogre mesh script author could adjust his work....  May be an option.

as i said, joint weights are missing in mesh file. it should be something like below but vertexboneassignment elements are missing
<boneassignments>
                <vertexboneassignment vertexindex="0" boneindex="12" weight="1" />
                <vertexboneassignment vertexindex="1" boneindex="12" weight="1" />
                <vertexboneassignment vertexindex="2" boneindex="12" weight="1" />
...
</boneassignments>

shadow

Hey guys! I got it running!
Thank you so very very much for your help!!

Problem was, that I used envelope bones and the exporter wasn't able to convert them to Ogre MESH Xml. Now I  made the same thing with Blenders "Weight Painting" and then the bone weights seem to be exported!

If someone is interested, I did my experiments today with a sample model which I uploaded to this archive:
http://iluzio.de/models2.zip

One thing is still a bit mysterious though, as you can see in the following image. I have arms, legs and head bones but they aren't rendered in the Sample app. But the torso and hip bones are rendered. There must be some difference between them...


raft


AGP

Raft, I have now tried OgreMax on both 3ds max 2009 and 3ds max 2010 (both 64-bit) and neither have worked (both have failed to run and give an error message when Max executes). I'm using the trial version, and I'm not feeling too confident in buying it. Did you have this experience with the trial or did did it run smoothly for you? Do you have a 32- or 64-bit installation of Max?

AGP

The 64-bit version simply doesn't work, the 32-bit one does. Anyway, how do I load an Ogre model into Bones? Is it as simple as:
java.io.FileInputStream inStream = null;
try {

     inStream = new java.io.FileInputStream(objectFileName);
     model = BonesIO.loadObject(inStream);
}
catch (Exception e) {System.err.println("Problem loading file: "+e.getMessage()); return;}

Or is there something more to it?