Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Brocan »

Any plans for make the script suitable for blender 2.56? :P
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

Yes, it is planned. :-) I'm trying to allocate time to work on this. Most probably end of next month though. :-(
Dusho
Gnoblar
Posts: 5
Joined: Sun Oct 24, 2010 7:13 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Dusho »

I'm looking for a way to import existing ogre animations into old 2.49b Blender. It is mentioned on several places that this exporter is also able to import Ogre stuff into Blender. Not sure if it's true, though. Don't see any import functions there.
Also when googling, found this: http://code.google.com/p/blender2ogre/
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

Hi, Dusho,

What you're looking for is not part of this blender script as this only does exporting. You're looking for the blender import script: http://www.ogre3d.org/tikiwiki/BlenderImport

What you found is another project intending to bring ogre exporting to the new blender 2.5. For the moment it's the only thing available right now for 2.5 until I get my butt into this. ;-)
Dusho
Gnoblar
Posts: 5
Joined: Sun Oct 24, 2010 7:13 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Dusho »

Thanks lf3thn4d.
So there is no import script that handles skeletons and animations, yet. I've compiled all the scripts I had and put together importer for Torchlight models (Ogre), but what I'm struggling with is how to apply animation translation correctly (also with combination of rest skeletons and action skeletons). I was looking for any help in existing scripts I can get. All I have is here: http://code.google.com/p/torchlight-to-blender/
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

I'm not exactly sure what you're trying to achieve, but translation of a full skeletal model is just simply moving the root skeleton node.
Dusho
Gnoblar
Posts: 5
Joined: Sun Oct 24, 2010 7:13 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Dusho »

lf3thn4d wrote:I'm not exactly sure what you're trying to achieve, but translation of a full skeletal model is just simply moving the root skeleton node.
just trying to import animations correctly.
Thing is, TL has animations split into separate .skeleton files (Walk, Attack, Run, ..) and those files contain also own skeleton. That skeleton can differ from skeleton defined in .mesh file. So in order to have it correct in Blender, idea is to calculate difference between 'action skeleton' and 'bind skeleton' and apply it to animation data (using original skeleton from mesh file). The script does that, but animations are bit 'wonky' and 'slidy', so I guess there is problem how and where it is applied (bonespace in ogre vs. armature space in blender?).
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by lf3thn4d »

Ah.. ok. I'm not familiar with how Torch Light does things. Can't really help you there. It could be a bug on the applying of the diff transform.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by cyrfer »

Dusho wrote:Thing is, TL has animations split into separate .skeleton files (Walk, Attack, Run, ..) and those files contain also own skeleton. That skeleton can differ from skeleton defined in .mesh file. So in order to have it correct in Blender, idea is to calculate difference between 'action skeleton' and 'bind skeleton' and apply it to animation data (using original skeleton from mesh file). The script does that, but animations are bit 'wonky' and 'slidy', so I guess there is problem how and where it is applied (bonespace in ogre vs. armature space in blender?).
Are the separate skeletons actually different than the main skeleton linked by the mesh? They must be the same, at least structurally, for the key frame data to be applied. The only way they could differ would be the bone lengths (parent-relative positions). In that case, TL probably ignores the parent-relative positions specified in the separate files when they apply the key frame orientations.

...At least, that's what I'd think you would do. I'm no animation expert, but I'd love to hear if this is wrong. I'm also interested because I was not able to correctly use the separate skeleton files [post on my symptoms]. Here is another (short) discussion with my views about using the linked skeleton files, if you're interested.

How did you obtain the TL files?
Dusho
Gnoblar
Posts: 5
Joined: Sun Oct 24, 2010 7:13 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Dusho »

yes, skeleton hierarchy is the same, sure.
But position and quaternion may differ from each other for same bones.
Also, having separate files for mesh and separate for every animation isn't just Torchlight specialty. It's actually very practical to have it this way and expand your animations independently, if needed.
Ogre does have Skeleton::_mergeSkeletonAnimations(OgreSkeleton.cpp) method that will merge skeletons for you -> calculate delta positions and quaternions between skeletons and apply it to all animations of original skeleton (basically what I want to do in Blender)
Oh. And unpacked TL media files come with TorchED (http://forums.runicgames.com/viewtopic.php?f=28&t=8046)- a tool that developers released to public (for modding community).
Garthy
Halfling
Posts: 47
Joined: Wed Dec 22, 2010 7:30 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Garthy »

"Warning: Vertex with more than 4 bones assignments!"

I was wondering what the latest on the above message is. Is there a way to fix this before it gets into the exporter [1], or is there an updated exporter somewhere that normalises to four bones when you have more, or can Ogre be told to normalise it automatically on load for you? Basically, without doing manual weight painting, how do you solve this?

I'm getting weird results when exporting animations (missing geometry), and I presume that Ogre is just using the first four weights specified. I could be wrong.

I just want to see if this problem is solved before I start trying to hack the script. It doesn't look *too* difficult ("meshexport.py", just below the code that emits the warnings, near the TODO would seem to be the place).

[1] I found some dead links to scripts that claimed to do this, but no live ones.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by so0os »

ogre automatically ignores bones with smallest weights leaving up to 4. It's your job to keep that below 4.
Sos Sosowski :)
http://www.sos.gd
Garthy
Halfling
Posts: 47
Joined: Wed Dec 22, 2010 7:30 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Garthy »

so0os wrote:ogre automatically ignores bones with smallest weights leaving up to 4. It's your job to keep that below 4.
Cheers for the fast reply.

I am uncertain what you are saying precisely. Is what you are saying is that if a vertex say had eight bone assignments, and they weren't in any particular order [1], then Ogre should, upon loading, already sort the weights, take the four largest results, normalise them, and use them (this is what your first sentence suggests)? OR are you saying that any more than four causes problems, and that I must ensure that there are less than four before using the exporter (this is what your second sentence suggests)?

[1] I've confirmed that the mesh exporter does not emit them in weight order.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by so0os »

Garthy wrote:
1. Is what you are saying is that if a vertex say had eight bone assignments, and they weren't in any particular order [1], then Ogre should, upon loading, already sort the weights, take the four largest results, normalise them, and use them (this is what your first sentence suggests)?
2. OR are you saying that any more than four causes problems, and that I must ensure that there are less than four before using the exporter (this is what your second sentence suggests)?
1. Yes. Try to load a mesh with too many assignments and read the warning inside ogre.log, it says just that.
2. Yes. If you're into doing models for real-time rendering, you have to keep to some constraints, and that is one of them. Even high-endest engines have that limit.
Sos Sosowski :)
http://www.sos.gd
Garthy
Halfling
Posts: 47
Joined: Wed Dec 22, 2010 7:30 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Garthy »

so0os wrote: 1. Yes. Try to load a mesh with too many assignments and read the warning inside ogre.log, it says just that.
2. Yes. If you're into doing models for real-time rendering, you have to keep to some constraints, and that is one of them. Even high-endest engines have that limit.
The two questions posed were mutually exclusive; I do not believe both answers can be "yes". Surely the process either works with more than four weights [1], or it does not? I'm leaving the comparison of quality aside for the time being.

[1] Although only the largest four are actually used.
User avatar
so0os
Bugbear
Posts: 833
Joined: Thu Apr 15, 2010 7:42 am
Location: Poznan, Poland
x 33

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by so0os »

http://www.ogre3d.org/docs/manual/manual_46.html
You must have no more than 4 weighted bone assignments per vertex. If you have more, OGRE will eliminate the lowest weighted assignments and re-normalise the other weights. This limit is imposed by hardware blending limitations.
Sos Sosowski :)
http://www.sos.gd
Garthy
Halfling
Posts: 47
Joined: Wed Dec 22, 2010 7:30 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Garthy »

so0os wrote:http://www.ogre3d.org/docs/manual/manual_46.html
You must have no more than 4 weighted bone assignments per vertex. If you have more, OGRE will eliminate the lowest weighted assignments and re-normalise the other weights. This limit is imposed by hardware blending limitations.
Cheers. That would suggest the first case then.

I'll have to dig further into why I'm missing geometry from the end result; I had thought it might be due to the extra bone weightings.
Garthy
Halfling
Posts: 47
Joined: Wed Dec 22, 2010 7:30 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Garthy »

Garthy wrote:"Warning: Vertex with more than 4 bones assignments!"
...

...
Is there a way to fix this before it gets into the exporter
Answering my own question:

http://www.ogre3d.org/tikiwiki/Normalis ... ture=Tools

This seems to clean things up for Ogre. Don't ask me how you're *supposed* to run it though. The way I did it involved copying the text into the text editor view window and hitting Alt-P. It seems to work though.

...

Interestingly enough, I'm getting a couple of problems with the output. For one model, the torso and arms seem to be missing entirely when exported. They appear in Blender fine. This happens with a fresh import and when animated. The same model [1] worked fine in 3ds Max with OgreMax.

When animated, an odd thing happens to the character- the legs warp backward in an odd kind of loop (imagine rubber legs grabbed at the middle of the calves and pulled back by a couple of leg lengths), and the feet stretch out. The result looks *hideous* and is completely different from the same animation inside Blender. Now that I've got the above script to restrict weights to four bones and normalise them, I can confirm that it's not a problem with there being too many bone assignments. The animation works fine in Blender itself. The same animation worked fine in 3ds Max with OgreMax when converted and dropped on a Biped. I used weights generated from bone heat in the Blender version if that makes a difference, and the materials are almost certainly wrong. I've hacked the export script to cap and normalise to four weights on output, the same but to one weight, and tried the above pre-processing script. The problem persists. Sometimes clearing out the weights for certain bits of the model and attaching them to one of the more central bones helps, but then of course the model does not animate correctly.

Are the above symptoms of any particular common problems that I could try to track down?

[1] - Technically, not the same model. The original model was in *.max form, and exported as *.obj to load into Blender, since Blender can't load in a native *.max file.
Sadr
Gnoblar
Posts: 16
Joined: Sun Oct 07, 2007 6:04 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Sadr »

Is there an open code repository, e.g. on GoogleCode or GitHub, where I can follow the latest updates of this script?
zphilip
Gnoblar
Posts: 2
Joined: Fri Feb 25, 2011 8:43 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zphilip »

Need some help here.
I am using blender 2.49b with the blender export script. Some files do export well. But The problem is with some .blend file, the export "selected" have empty list. I am totally new to blender. For example I try to export the Otto (http://www.virgiliovasconcelos.com/otto/) to ogre .mesh/.skeleton file, but nothing I can select in "selected". Anybody know the problem?
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by LiMuBei »

zphilip wrote:Need some help here.
I am using blender 2.49b with the blender export script. Some files do export well. But The problem is with some .blend file, the export "selected" have empty list. I am totally new to blender. For example I try to export the Otto (http://www.virgiliovasconcelos.com/otto/) to ogre .mesh/.skeleton file, but nothing I can select in "selected". Anybody know the problem?
Well, if you don't select anything in Blender, then the list will be empty. To select a mesh, simply right-click it in the viewport.
zphilip
Gnoblar
Posts: 2
Joined: Fri Feb 25, 2011 8:43 am

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by zphilip »

LiMuBei wrote: Well, if you don't select anything in Blender, then the list will be empty. To select a mesh, simply right-click it in the viewport.
thank you, it really work like you said. :)

br philip
Onsokumaru
Kobold
Posts: 36
Joined: Tue Mar 01, 2011 3:41 pm
x 1

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Onsokumaru »

Brocan wrote:Any plans for make the script suitable for blender 2.56? :P
lf3thn4d wrote:Yes, it is planned. :-) I'm trying to allocate time to work on this. Most probably end of next month though. :-(
I know you're doing this for free and in your spare time, but how is the status of porting this script to blender 2.5?
I'm new to blender and I'm more familiar with 2.5 then with older versions, I would appreciate it if this great script could get ported in the near future.
At the moment I'm solving this problem with using 2.4 for exporting my meshes, but animations from 2.5 get in 2.4 lost. So I've to do all animation in 2.4. In the end this request to port the script in 2.5 is just a comfort thing but it would be very nice to have this script working in the new versions of blender. :)

Edit (March 04):

I've collected my first experiences with the exporter, blender and ogre3d and maybe it owuld be better to change the "vertex not assigned to bone"-warning as mentioned here
SRombauts
Kobold
Posts: 39
Joined: Mon Feb 28, 2011 6:58 pm
Location: Paris, France
x 2

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by SRombauts »

Hi,

For Blender 2.5 Exporter, see the dedicated thread there :
http://www.ogre3d.org/forums/viewtopic. ... 0&p=421789

Regards,
SRombauts
http://www.srombauts.fr, comments from an Android developer
Sadr
Gnoblar
Posts: 16
Joined: Sun Oct 07, 2007 6:04 pm

Re: Latest Blender Export Script [Wed Aug 25, 2010 - v1.4]

Post by Sadr »

@SRombauts I'm pretty sure you just linked to an exporter that's unrelated to the one that is being discussed here.