www.jpct.net

Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: efaj on December 27, 2011, 02:11:11 pm

Title: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on December 27, 2011, 02:11:11 pm
Exception in thread "main" java.util.NoSuchElementException: tag [-in] not found
   at raft.jpct.bones.util.ComLineArgs.getArg(ComLineArgs.java:97)
   at raft.jpct.bones.util.ComLineArgs.getArg(ComLineArgs.java:115)
   at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:149)

It's not due to Bones, as the exporter (Blender 2.61 to Ogre) is giving my errors already, but I'm curious: What does this error mean? What in particular is missing? (And just in case, which is the file that I should pass to jmeOgre2Bones.sh ? )
Title: Re: tag [-in] not found
Post by: raft on December 27, 2011, 02:16:46 pm
if you give no arguments it will display a help

basic usage is as follows:
Code: [Select]
JMEOgreImporter [options] -in <ogre.mesh.xml> [ogre.mesh.xml...]
for example:
Code: [Select]
JMEOgreImporter -out myFile.bones -in MyOgre.mesh.xml
you got the exception because you give at least one argument but omit the mandatory -in tag
Title: Re: tag [-in] not found
Post by: efaj on December 27, 2011, 03:09:13 pm
-infinite amounts of facepalm- Ok, now it got past that. And it got me more intrigued o.O

Code: [Select]
Skeleton created out of jME OGRE skeleton, 16 joints
Exception in thread "main" java.lang.NullPointerException
at raft.jpct.bones.BonesImporter.convertJMEMeshData(BonesImporter.java:438)
at raft.jpct.bones.BonesImporter.importOgre(BonesImporter.java:193)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:112)
at raft.jpct.bones.util.JMEOgreImporter.loadGroup(JMEOgreImporter.java:88)
at raft.jpct.bones.util.JMEOgreImporter.run(JMEOgreImporter.java:69)
at raft.jpct.bones.util.JMEOgreImporter.main(JMEOgreImporter.java:170)
The error the exporter gave me was regarding:
Error: root bone has non-zero transform (location offset)
So, I'd assume what should be missing is the armature/skeleton... but that line points to a mesh array, and it prints as if apparently the skeleton was alright.

Anyways, this time it goes to any Blender user out there:
Error: root bone has non-zero transform (location offset)
How do I fix that? I already tried CTRL+A to apply everything it gave me an option to and didn't help. In Edit Mode it doesn't work, so as to maybe set it to the bone directly.
Title: Re: tag [-in] not found
Post by: raft on December 27, 2011, 03:23:15 pm
are you sure you are using latest version? as mentioned in this thread (http://www.jpct.net/forum2/index.php/topic,2318.msg17998.html#msg17998) that exception is solved

i'm not a Blender guy. so I can't help you about that.

have you tried clearing transform of root bone?
Title: Re: tag [-in] not found
Post by: efaj on December 27, 2011, 04:37:29 pm
Checking at the source, it looks like it was already applied on my version. And the modified date matches. Anyways, re-downloading from http://www.aptalkarga.com/bones/bones.zip .

Same thing happened... and now I downloaded ones preconverted. (Ninja is converted correctly though)

And about the transform issue... if I knew how, I would. I've been googling and asking around, and nothing found nor any reply yet.
Title: Re: tag [-in] not found
Post by: raft on December 27, 2011, 04:41:52 pm
interesting. i'll pm my email to you. if you send me mesh amd skeleton files, i'll have a look..
Title: Re: tag [-in] not found
Post by: efaj on December 28, 2011, 01:53:16 am
I followed this recomendations that seem to be in general more "export friendly" http://www.stonetrip.com/developer/forum/viewtopic.php?f=24&t=24553
Except for the way the bone is placed, instead of extending on X, it extends on Z (which is like Ninja is)
Now, the root bone error is gone and the exporter shows no error and the correct amount of animations, etc, exported.
Bones script gives the same errors though.

Sent you two, one before I applied the fix, and the latest with the fix.
Title: Re: tag [-in] not found
Post by: bili on December 28, 2011, 02:15:25 am
plz go to my post #4 in http://www.jpct.net/forum2/index.php/topic,2475.0.html (http://www.jpct.net/forum2/index.php/topic,2475.0.html) thread for more details.
Title: Re: tag [-in] not found
Post by: raft on December 28, 2011, 01:35:25 pm
please download and try this version:
http://www.aptalkarga.com/bones/bones_beta.zip

this fixes the NullPointerException. indeed this is a workaround. i consider this as a jME bug. it places a null texture buffer among others. anyway..

but you will encounter another problem. it's either caused by jME or Blender exporter, I'm not sure yet. play with exporter options and try to switch off "shared geometry"
Title: Re: tag [-in] not found
Post by: efaj on December 28, 2011, 02:23:04 pm
My exporter gives me no options... hmm... jME.

I'm going to browse around jME stuff and see what I can do and export stuff the way they do and see if there are related problems there.
Now I'm almost sure it has to be the exporter.

EDIT: Nope, I'm using the exporter they all use... at least the ones with 2.6
Title: Re: tag [-in] not found
Post by: raft on December 28, 2011, 03:56:36 pm
nope, it's jME. and I guess I fixed it. please re-download the beta from the link above
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on December 29, 2011, 04:41:51 am
My laptop broke... I'll have to check this later...  :'(
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on December 30, 2011, 01:21:34 pm
You know... I had downloaded it on my laptop, and now I was going to redownload it to my netbook to try it here... but it's downloading at 0.1 kbps o.O
Is your server undergoing maintenance or what?
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on December 30, 2011, 01:36:06 pm
must be a temporary or local issue. i can download with more than >300kbps
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on December 31, 2011, 10:29:50 am
Yup, it downloaded smoothly now.
Alright, tried it and sweet! It's on screen and it shows me the animation option (I'm testing using the LoadBonesFormatSample...
But, it's not getting animated the walk and some faces are missing: Bottom chest area, all the back, and upper part of left leg (Also, there's some in both legs that when rotated show like weird parts of the texture, from the upper areas... maybe some chest but I also see some skin, so it may be head too, but I think it may be the model -Ok, never mind this, I found there's some extra faces inside the legs and I'm on them-)
*sigh* the netbook gets stuck with Blender... couldn't even check for those faces. I'll have to postpone the 3D dev for now. How did it looked in your test -if any-?
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on December 31, 2011, 05:10:26 pm
i've similar results:
(http://s13.postimage.org/9eutx49oj/front.jpg) (http://postimage.org/image/9eutx49oj/)
(http://s17.postimage.org/5oyvf7pd7/back.jpg) (http://postimage.org/image/5oyvf7pd7/)

it's indeed animated but we see no results because all animation values are zero. have a look at skeleton file, all rotation and translations are zero. somehow your exporter does not export animation values.

missing polygons are interesting. i thought your model might be like that but obviously not. what is the polygon count of your model? there are 439 polygons in this file. i want to learn if some polygons aren't exported or got lost somewhere.

also, does your exporter have a viewer? if so, try to open exported files with that. OgreMax has a viewer and it's very useful to find who's fault incorrectly viewed models are ;)

Title: Re: exporting Blender>Ogre>Bones
Post by: raft on December 31, 2011, 06:48:38 pm
this is how your model looks in OgreMax viewer:
(http://s17.postimage.org/5d50jcjl7/front.jpg) (http://postimage.org/image/5d50jcjl7/)

seems as this is caused by your exporter.

btw, which exporter are you using? if this one, seems as it provides many options
http://www.ogre3d.org/tikiwiki/Blender+Exporter
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on January 01, 2012, 06:38:39 am
The model in blender has:
Vertices: 197
Faces: 407
Edges: 567

So... if I'm not mistaken, there's actually more polygons there? o.o It may be possible that blender uses quads while the exporter converts them to triangles... but, I can't get into depth without Blender crashing on my netbook.

I'm using this one: http://www.ogre3d.org/forums/viewtopic.php?f=8&t=61485&sid=19886363f853b0709858c42dccc8abfb
It's for blender 2.6x, the current release and the one I'm using is 2.61... It has no viewer, and no options. What's used apparently is Ogre Meshy... which I couldn't get to work on Linux, nor now on the netbook on Windows.

However, it seems 2.49 has many more scripts (despite a HORRIBLE interface), like a Poly Reducer that keeps UV maps. And that exporter is 2.49... I'm gonna try it and post the results.

Edit:
How it should have looked:
(http://i597.photobucket.com/albums/tt57/efaj/link.png)

While taking this image... I had an idea: My root bone is connected to the chest bone, but there's an offset... maybe the chest got moved by that offset. I'll see if my netbook cooperates on this one.

Edit2:
The animation itself was lost from Blender... I'm looking into this... weird thing is all the keyframes are correctly... just not moving anything. but that's something for me to mess with Blender. Maybe after remaking the animation and fixing the root bone it will all work with the 2.6 exporter.
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on January 01, 2012, 06:52:42 pm
well, good luck ;)
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on January 04, 2012, 03:00:33 pm
IT'S ALIVE!
After remaking the animation, it did work! Using the 2.6 exporter and bones beta.
Only issue is still the missing vertices which didn't have anything to do with the root bone's offset after all.
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on January 04, 2012, 03:10:37 pm
cool :) about missing vertices, have you encountered anything similar in Ogre forums?

maybe after all settled, you write a wiki page for other blender users ;)
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on January 04, 2012, 04:47:41 pm
Yup, I was thinking on it.

And I haven't been able to find anything about that in ogre forums... googling I ended up back on this topic before finding anything. So, I started animating another object to see if the same happened or at least the cause was clearer...
And, I did find where were the options for this exporter.... my bad. But, I also found another error:
(http://i597.photobucket.com/albums/tt57/efaj/error.png)
From the above, everything was checked on with that error except "Only animated bones". The options as you see where used in a future test which output the same.
(http://i597.photobucket.com/albums/tt57/efaj/options.png)
On the left side there's also the options of the exporter, though I didn't find "shared geometry". Are there any settings that may help?
Do you know what's that Exception about?
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on January 04, 2012, 05:12:54 pm
i guess the exception happens because an index refer to a vertice or UV coordinate that is ahead of array size. please re-download the beta, it should throw a more meaningful exception for that

you can try switching off 'optimize arrays' and 'reorganize buffers' options
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on January 04, 2012, 07:34:27 pm
I re-downloaded, but the warning was the same... but, since you mentioned it, the error was related to having 2 materials on the same mesh. So I split them in 2 meshes, and no prob now.

And, I finally found out the cause of the "missing vertices": They were vertices that didn't belong to any bone.

So now I'm gonna ask for a wiki account and get that entry going.

Edit: Wiki page is up. http://www.jpct.net/wiki/index.php/Exporting_from_Blender_to_Bones#Exporting
I linked to the Bones beta for now since I don't know if/when the main version will have the jme fix.
Title: Re: exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 01:35:14 am
Thanks to both! Im in similar boat as efaj. Hopefully I can use the info here to sort out my model issues.

@efaj: can you briefly outline some instructions on how can I locate vertices that do not belong to any bones in blender?
Title: Re: exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 11:11:31 am
Every vertex that remains has no bone assigned. So either you do what I did and remember their positions and go to weight paint mode... OR you do the smart way and add them to a vertex group from there:
With those missing vertices still selected, on the Properties panel, click the Vertex Group you want to add them to, and click "Assign".

After you are done, use Alt+H_key to make all the hidden vertices visible again.

The following may just be me, or may be because I haven't experimented enough but here goes in case after all that you are still missing vertices:
HOWEVER, I noticed that maybe because of how Blender has different weights, that it seems only those on max weight (red on weight paint mode) are counted, so after this you may want to test your model on LoadBonesFormatSample.java from Bones's examples. Then, whatever is missing from there, you go to vertex paint mode to paint it for the corresponding bone.
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on January 05, 2012, 01:07:33 pm
cool, I'm glad you finally  solved the issue :)

i've removed the beta link and made this the official release.

for meaningful exception, last time was my bad, an arithmetic error, now it should throw a meaningful exception instead of ArrayIndexOutOfBoundsException
Title: Re: exporting Blender>Ogre>Bones
Post by: raft on January 05, 2012, 01:08:49 pm
and of course thanks for the wiki page :D
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 04:56:08 pm
Alright, I changed the wiki link to point at just the Bones webpage (Since I was already linking to something, might as well link to the site just in case someone would read it without Bones).

And the wiki page was no prob, just giving back for the help and awesome engine that is jpct+Bones  :P
I had been analyzing several java 3d engines, and the software mode was exactly what I wanted... Skeletal animations and software mode were all the things I needed on an engine.

I'll try to contribute some more in the future. And while I'm on it, your glFont and texturePack are also great
Title: Re: exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 06:09:56 pm
@efaj: thanks for your instruction but after I done that, there is no vertex left so I guess all vertex were assigned to bone groups accordingly.

But my problem is still the same, any guess what may cause the problem in the pic included below?
(http://farm8.staticflickr.com/7025/6641996655_3ebbc34fe3_b.jpg)
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 06:14:16 pm
add a picture of your original model too.
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 06:33:34 pm
here you go:
(http://farm8.staticflickr.com/7023/6642125493_a6a0d375b4_b.jpg)
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 07:26:40 pm
If you have all your vertices as part of a vertex group, and with weights that look Red in weight paint mode, the only other thing that I can think of that would also make sense considering some vertices seem to be moved towards another bone would be that some of your vertices are part of 2 groups at once:
For example it looks like some of your arm vertices are part of the head bone or leg bone...

But, that looks just like the issue I had when not all vertices were weight painted. I'd recommend you to double check on that.

On the exporter, try unchecking all the Optimize options too.
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 07:39:15 pm
Thanks. I will look into that. I got the mesh model from my friend and I did the bones myself so I used automatic weights to deform the mesh as I dont realy know how to use weight paint... :o. This is probably the reason why vertices are part 2 groups...

Her is how it looks like in weight paint mode, it looks odd to me...
(http://farm8.staticflickr.com/7172/6642453525_3d7189f529_b.jpg)

Im going watch few vids on how to use weight paint now.  :-[
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 08:10:16 pm
Yes, as you can see, the weights for that bone are not Red, but yellow. That's like a 0.5 weight. Blue is 0, vertices not affected by that bone will be blue. And Red is 1, the max weight, where they will be completely affected by the bone.

Also, there's nothing wrong with vertices being part of 2 groups... the problem is if they are part of groups that are too apart: The vertices of the knee can be part of both the thigh and leg. But, I'd recommend to keep them to a minimum... in the preview image it looked as though some vertices were part of both the hand and head for example.

And, I'd recommend NOT to use blender's automatic weights as they won't be 1.0 (Red) and may even be badly done. Doing them yourself gives you more control and makes them right. And with weight paint, it doesn't take too long.

And last, I don't like video tutorials P: but here's the one I had used to learn about weight paint:
http://wiki.blender.org/index.php/Doc:2.4/Tutorials/Animation/BSoD/Character_Animation
It's pretty complete. Go to the middle, to the Rigging section
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 08:35:58 pm
Thanks for sharing the link Im reading it now.

By shear chance and random luck...I got it to work, I went into weight paint mode and paint the yellow bit to blue and the model shown up complete without missing bits or pieces in LoadBonesFormatSample.... :-\
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 09:02:58 pm
Ok... i didn't understood the last one... first, you should have painted from Yellow to Red. Blue means removing them from the bone. Red = belongs to bone. So if all is Blue, I guess all your model is missing or at least not animating?

But, if you did got it to work, why the  :-\ face?

Just to clear things: Do you still have a problem or not?
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 09:12:20 pm
Well the model loads up fine, nothing missing but the animation has messed up. I tried that before I read your thread so that's why I said  it was luck but it's not enough for my case!

The animation is fine in blender but when it's played in SampleBoneFormat, it looks like the mesh dont deform well with the bones.

A pictures worth a thousand words! Here:
(http://farm8.staticflickr.com/7156/6642953063_9ac3af0914_b.jpg)
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 05, 2012, 09:38:10 pm
Take one with just the skeleton (in that same animation)
All the weights already must be fine, it must be related to the bones and their position. Maybe your skeleton is not the same size of your object?
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: bili on January 05, 2012, 09:58:53 pm
I think you're right. The skeleton seems to be upside down or something like that.
(http://farm8.staticflickr.com/7025/6643173051_00b103fe81_b.jpg)
and here is just the skeleton, why it looks so weird lol
(http://farm8.staticflickr.com/7154/6643231823_0411e3289c_b.jpg)

Im going redo the armatures. I ran the Ninja model and every bones shown up in place while mines are everywhere.
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: raft on January 05, 2012, 10:26:12 pm
oops, that is really weird..
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: efaj on January 06, 2012, 02:55:16 pm
Maybe you hadn't applied the transformations? Ctrl+A on the armature too. If they are not applied, the animation sequence may be what finishes making that look so weird: Without them applied, the armature would be in a position different to the one the keyframes expect.

But yeah, redoing the armature may be the best since I have no further idea of what's going on there.
Title: Re: [SOLVED]exporting Blender>Ogre>Bones
Post by: bili on January 07, 2012, 01:16:46 pm
yup, redid the armature finally sort it! Thanks guys.