jME and Blender: The age-old question

Dang…I actually was talking to a coworker today about Collada, and possible formats for him to use from Blender for his OpenGL learning.  I suggested OBJ for simplicity, but…yeah.



I was actually going to look into whether it was feasible or not yet, so thank you!  I really would like to be able to work with the new Collado stuff in jME, but…yeah, there's that barrier.  I could use Maya, but I'm unfamiliar with it and I don't know if the learning version would work with the existing plugin, not to mention the issue of not being able to use it for anything non-self-educational.

Fungi, I can't get it to work :frowning: I have trued using the modified translator.py and collada.py files, as well as the most recent svn source from illusoft - but the exported collada file just doesn't look right. There is no occurrence of either the words "SKIN" or "WEIGHT" in it. I used all the recommended settings from your post, and blender 2.4.4, and I just can't figure out my mistake! Could you possibly upload a blender file with a skeletal animated model you had success in getting into jME?

sure, no problem. I'll post later today. If you don't mind posting your blend and dae files as well i'll take a look

Done, get it here:

http://wwwhomes.uni-bielefeld.de/krabien/jmestuff/daetest.zip

And thanks for looking into it!

It has something to do with blender 2.4.4. I’m using 2.4.3 and it seems to work fine.

http://www.sharebigfile.com/file/201905/colladatest-zip.html

here is the test i made.

About Cal3D I just want to tell you that I have been able to make it work, months ago, simply fixing/commenting some little code.



If you read carefully this thread you will discover that is still possible to use the kman’s Cal3D loader. I also made months ago a fix to one of the several versions of the blender2cal3d exporter, scatered around the web in different projects.



Everything is reachable from the last post in this thread: CAL3D Loader and Viewer. While, in the several posts in the middle, you can find some of the changes I made to the Cal3D loader to make it run with the new jME API.



Furthermore, if you read Blender2Cal3D fixed for Blender 2.42a you will see, in the last few posts, that ideasman42 updated a refactor of blender2cal3d exporter in the Blender CVS repository, that, accordingly to the discussion, seems to work.



Furthermore (2 ;)), there is also a rewrite of the blender2cal3d script, by Palle, available in the Cal3D SVN.



Cal3D never die! :wink:

long live collada!!  :smiley:

Fungi said:
long live collada!!  :D


Of course.

To be serious: I love all the 3 formats Collada, MD5 and Cla3D. Each one is usefull for different reasons.
Furthermore I am slowly working on the MD5 Reader 2 fix of the current code and at the same time on a refactoring fully supporting BoneAnimation and SkinNode.

But I decided to replay this thread about Cal3D because in the earlier posts someone said that kman's Cal3D loader and the Blender exporter are not working at all. Just wanted to say that there are solutions to these problems.

Fungi, thanks for the hint, collada export works fine with Blender 2.4.3 and the scripts you provided! I see a warning for skeletons with multiple roots, however - is that not supported by collada?

hevee said:

Fungi, thanks for the hint, collada export works fine with Blender 2.4.3 and the scripts you provided! I see a warning for skeletons with multiple roots, however - is that not supported by collada?


I don't know, I've never tried. further more i'm not even sure i know how to make a skeleton in blender with multiple roots  :)

@Fungi



The good news first:

I found out how to export skeletal animation from blender 2.4.4. All you have to do is convert the “virtual” armature deformation modifier under mesh modifiers to a “real” one. Not sure if that’s documented somewhere, at least I didn’t find it.



The bad news:

It looks like there can always be only one animated bone per animation! :’( Or, to put it the other way, every bone’s animation arrives in jME as a separate BoneAnimation, so you can either animate bone1, or bone2, but never both at the same time. Is that intentional?

For starters: I don't know much… but i'll try my best to sound like i know what I'm talking about  :wink:



Blender has actions that can group animations, never used it before(I tried but i didn't figure it out) and I don't know if the Collada exporter supports them. I wouldn't count on it though from what i can remember of the code.



Yeah they are imported as separate animations but you can easily group them by creating a new animation, add all the sub animations to it, and then using the optimize method. I think when you create the parent animation you have to give it the same animation times as the sub animations but i can't remember, it has been a while since i looked at the code.

Fungi said:

Blender has actions that can group animations

Yes, that would be the thing I'd expect to translate to BoneAnimations in collada, at least looking at the way mojo's test example is using them.
It is conceptually the same, distinct, named animation sets animating several or all bones for a different effect (walking, standing, hitting...).
Fungi said:

Yeah they are imported as separate animations but you can easily group them by creating a new animation, add all the sub animations to it, and then using the optimize method.

Thanks, I'll try that!
Fungi said:

Yeah they are imported as separate animations but you can easily group them by creating a new animation, add all the sub animations to it, and then using the optimize method.

Tried that, unfortunately all bones end up in the same location with it, otherwise it seems to work.

To clarify:
1. export skin+skeleton from blender, don't use animation -> works
2. try a single animation -> works
3. try the method above, without optimizing: -> bones seem to animate ok (rotation-wise), but all are in the same position.
4. like 3., but with optimizing: same result as under 3.

Am I still missing something?

hmmm here's an idea :

writing an jME exporter for blender.



while calling jME functions from python ( somehow ), you could easily supply vertexes, bones, textures and all the other stuff to jME classes, and write that down to *.jme format.

i guess i'll have to look into this, but i don't know python, and i'm using blender and jME fairly for a short time. maybe i'll finish it in a year or two.

hevee already did that, as well as a few others i think

Fungi said:

hevee already did that, as well as a few others i think

can you give me a link or something ? is it up to date ?

i'm not thinking of exporting a model to xml format then reading it from jme. i'm thinking of calling java classes from python (somehow), filling them with information and then writing them down...

You can call Java code from CPython by using the JPype bridge, http://jpype.sourceforge.net/



In [3]: import jpype
In [16]: pwd
Out[16]: 'd:\java\jdk\jre\bin\client'

In [17]: jpype.startJVM("jvm.dll", "-ea")

In [18]: jpype.java.lang.System.out.println("hello world")
hello world



I mentioned that once on the Blender forums too, when someone was in need of using some Java lib inside Blender.

BTW / little first post intro: I am a jME newbie, who's been interested in this engine for some days now after discovering it by a hint a #blenderchat where someone was looking for a Java 3d engine (he wanted crossplatformness, possiblity targeting mobile devices too). Am interested in jME because Java Web Start seems to work pretty good nowadays, and gl performance is acceptable -- we have been making games and other interactive (3d) things in mostly Python so far, using Soya3d and Ogre, but may well also need 'web startable' things in the future. I've been quite involved with Blender lately, especially having been working in the Orange project but also otherwise regarding mostly the py API dev, and in our company we use Blender for our games so this issue is pretty relevant for me.

I've also had the idea of using engine-native code from Blender for exporting, like a Blender Soya3d or Ogre exporter could create the objects in py using the engine as a lib (via pyogre in case of Ogre), but I'm unaware of anyone having done that yet. May be that things are fine with the current exporter-writes-a-file method, especially if standard formats like Collada are used, but who knows .. might be an interesting experiment anyway, to use jME code in Blender.

~Toni

I'd much prefer a new xml format, since that isn't blender specific but could be used by other exporters as well. Of course, in a perfect collada world, no other file format would be neccessary any more, so I re-posted my question in a separate thread, because it was only marginally related to this thread's topic anyway.

See:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=5761.new#new