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.
Post Reply
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

I'm not sure what you meant by submesh here but I think you misunderstood what ogre's submesh is. This has been pointed out before. See http://www.ogre3d.org/forums/viewtopic. ... 50#p324608 and the replies after that. :)

Glad that custom materials worked good for you. :D
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by cyrfer »

[quote="lf3thn4d"]cyrfer: I'm not sure what your problem is, but it's definitely not the exporter. My last experiment with the exporter gave correct result for shape keys. Maybe it's to do with your code? Do remember that shape key is about morphing from one pose to another, so frames doesn't matter.

lf3thn4d: Would you please point me to a Blender file that has shapekeys which export well? I'd like to rule out that my code is not the problem. My code has played one of the OGRE sample mesh files already, but the one I tried to export did not play well. Making shape keys in Blender was really easy, as seen in the tutorial I linked. Maybe there is something special that needs to happen for the exporter to work? Thanks for any help.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

cyrfer: pm me your email. I'll send a sample I used for testing.

It's too bad the old pdf tutorial on how to do this got lost. I lost my copy as well. :( If anybody would be so kind as to make a new one, it'll be great. I could probably embed it as part of the help manual.
Thumpin3D
Gnoblar
Posts: 5
Joined: Wed May 06, 2009 6:58 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by Thumpin3D »

lf3thn4d wrote:Hi, as of now, i think there's no real way to find out. My recommendation for now is to do manual vertex weight painting. It's the most sure way to get full control over your character skinning. Maybe we should have a helper script to highlight bad vertices that has more than 4 bone assignments.
Could someone please validate the simple rig in this blend file......Would really help if Blender users can found out the export error, because i am unable to debug this.

Please download the file at
http://brianchacko.weebly.com/archives.html

The file name is trialWithoutSkeleton.blend
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Your mesh skeleton assignment has two problems.
1. Some vertices are not tied to any bones. Move your root bone far away to see it. Those that are not attached to any bones would stay stationary causing elastic effect.
2. Many vertices are having more than the allowed 4 bones limit. This means that the vertices is referring to more than 4 bones for it's weighting.

For second problem, you need to remove unnecessary bone weights that doesn't interfere with the vertex much. To find out which vertices has the problem, select the vertex in debug mode and have a look at the "vertex deform group" drop down under the Transform Properties window(press N in edit mode to show). Most of the problematic vertices are around the body and fingers.

I know it's not simple to fix. This is why rigging is a professional job. ;)
Thumpin3D
Gnoblar
Posts: 5
Joined: Wed May 06, 2009 6:58 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by Thumpin3D »

lf3thn4d wrote:Your mesh skeleton assignment has two problems.
1. Some vertices are not tied to any bones. Move your root bone far away to see it. Those that are not attached to any bones would stay stationary causing elastic effect.
2. Many vertices are having more than the allowed 4 bones limit. This means that the vertices is referring to more than 4 bones for it's weighting.

For second problem, you need to remove unnecessary bone weights that doesn't interfere with the vertex much. To find out which vertices has the problem, select the vertex in debug mode and have a look at the "vertex deform group" drop down under the Transform Properties window(press N in edit mode to show). Most of the problematic vertices are around the body and fingers.

I know it's not simple to fix. This is why rigging is a professional job. ;)
Hey...Thanks...Will take a look at it..
AnTeevY
Kobold
Posts: 33
Joined: Mon Sep 18, 2006 3:55 pm
Location: Germany
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by AnTeevY »

hmm, I guess this is a stupid question, but... I have problems exporting textures. My (cube) object has a simple .png texture, but in the exported material file there is only the material color and not the texture I've attached to it. Displays fine in Blender though (F12). I'm sure there are some things I forgot to do since I'm new to Blender.

Edit:
Meh, sorry.
The script exports image textures with "Map Input" set to "UV" and "Map To" set to "Col" and optional "Alpha". The supported image options are marked green.
Last edited by AnTeevY on Mon Sep 21, 2009 1:03 pm, edited 1 time in total.
User avatar
nikki
Old One
Posts: 2730
Joined: Sat Sep 17, 2005 10:08 am
Location: San Francisco
x 13
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by nikki »

AnTeevY wrote:hmm, I guess this is a stupid question, but... I have problems exporting textures. My (cube) object has a simple .png texture, but in the exported material file there is only the material color and not the texture I've attached to it. Displays fine in Blender though (F12). I'm sure there are some things I forgot to do since I'm new to Blender.
In the material options in Blender, select TEXFACE.
AnTeevY
Kobold
Posts: 33
Joined: Mon Sep 18, 2006 3:55 pm
Location: Germany
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by AnTeevY »

Thanks, I tried that all the time but then the exporter crashed, because I did not check "UV" ;)

Edit: Well, when I load the mesh into Ogre it's just blue all around (which is the main color of the texture). If I change the texture e.g. in Paint to a red one, the mesh gets red as if Ogre used only one pixel of the texture. The material itself works fine (on other entities), so there's a problem with the mesh. I'm sure it's again only one option I forgot to enable...

Edit2: Damn, why do I always find the solution a minute after the forum post. Of course I had to add a new UV Texture in the mesh settings.
BSer
Halfling
Posts: 95
Joined: Fri Dec 23, 2005 8:46 pm
Location: Niskayuna, NY
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by BSer »

There's a problem that I dare call a glitch with the Blender exporter. I export a model with a lone animation (supposed to be upper-body only), and when I export the model with many animations, the supposedly same animation is different. There seems to be a contamination potential when exporting a list of animations using the Blender exporter. The pose left by the an animation in the list may be adopted by subsequent animations. This is causing me no end of grief. Shouldn't the skeleton be reset to the binding pose in Blender prior to doing the export calculations for each animation? If so, is a fix in order?

The following are the starting poses of the supposed same animation in the two different export runs:
Image
you can see how for the second one, the state of some other animation has affected it. Observing the export in progress seems to make it more clear. The run animation precedes this one in the sequence, and apparently leaves the legs in the run stance.
oli03
Gnoblar
Posts: 1
Joined: Tue Oct 13, 2009 4:00 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by oli03 »

Hi,

I experiment with the exporter. I want to do pose animation in OGRE so I use Shape Keys in Blender.
In OGRE I will lately implement a facial animation system, so I don't want export a full animation, I just want export the different poses of the mesh.

1) So I export without define any pose in the "pose" list of the exporter, I load the generated binary mesh file in Cegui Mesh Viewer, I retrieve the two shapes keys (or poses) I've made but when I use the slider to see the effect, the mesh does'n deform correctly.
Image
At left : In Blender, it's Ok, At Right : In Cegui Mesh viewer (don't take into account the materialn the rotation...)

2) if I define one pose (I click on the "add" button) in the "pose" list where all the shape keys are zero, I have a warning message "Pose animation does not differ from restpose" and it is ignored. The final result is the same.

3) When I define an animation and I click on the " Add" button, specify that the animation is from key 10 to key 15, the result is ok in CEGUI Mesh viewer

Can somebody tell me if this behaviour is normal and why ? (there's only one line in the doc)

Thank You
Olivier
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

@BSer: ATM, the script exports all bones. It doesn't care if the bone keys were set or not. This is because it's using keyframe sampling to bake the bone animation. Reason for this is that sometimes animation is done using IK. In that situation, the bone keys are not set. A way to selectively export bones for each animation is planned. However, right now, you have to make do with hand editing the exported xml file. Really sorry about this.

Note: Anybody who wants to try their hands on adding this feature is welcomed to work on it. :) Due to the amount of work I'm doing right now, I do not have much time for this at the moment. :(

@oli03:
1. I'm not sure what's going on with that. Seems like some bug or something. You might want to try resetting the mesh's scale and transform (ctrl-A).
2. Yes, that's normal. You were trying to export a pose that is practically the base mesh. Remember that the base mesh IS the base pose. That is to say all pose weight is set to 0.
3. This is ok. So nothing to comment about. :)
hendric
Gnoblar
Posts: 1
Joined: Thu Oct 29, 2009 3:34 pm

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by hendric »

Hello all,
Newbie here. I had some problems following the Wiki on using the script, so I tried to update it so it is easier to follow. Feel free to comment or fix.
http://www.ogre3d.org/wiki/index.php/Blender_to_Ogre
servvs
Gnoblar
Posts: 2
Joined: Mon Nov 02, 2009 6:25 am

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by servvs »

Ok im having some major troubles getting this to work at all. Ive used python 2.6 and same version blender and I would export and then import again to test it, and it would be either enlarged and super thin, or just super enlarged. Im now trying with python 2.5.4 and its corresponding blender version. When I import already created ogre mesh files and export they will import again just fine. When I create anything in blender and try to export and import as a test it doesn't do anything. I get this error

Code: Select all


Compiled with Python version 2.5.2.
Checking for installed Python... got it!
Reading mesh file C:\Users\servvs\Desktop\Cube.mesh...
No mesh.xml file. Trying to convert it from binary mesh format.
executing OgreXmlConverter.exe "C:\Users\servvs\Desktop\Cube.mesh"...
'OgreXmlConverter.exe' is not recognized as an internal or external command,
operable program or batch file.
done.
Mesh with 0 shared vertices.
Traceback (most recent call last):
  File "C:\Users\servvs\AppData\Roaming\Blender Foundation\Blender\.blender\scri
pts\ogre_import.py", line 453, in fileselection_callback
    object = CreateBlenderMesh(meshname, handler.mesh, materials)
  File "C:\Users\servvs\AppData\Roaming\Blender Foundation\Blender\.blender\scri
pts\ogre_import.py", line 236, in CreateBlenderMesh
    bmat = create_blender_material(omat)
  File "C:\Users\servvs\AppData\Roaming\Blender Foundation\Blender\.blender\scri
pts\ogre_import.py", line 417, in create_blender_material
    img = omat.getTexture()
  File "C:\Users\servvs\AppData\Roaming\Blender Foundation\Blender\.blender\scri
pts\ogre_import.py", line 117, in getTexture
    except IOError, (errno, strerror):
ValueError: need more than 1 value to unpack

And like I said, I have re-imported other ogre meshes for a first test and it worked just fine, but when I do anything of my own, it spits out this... any ideas?
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

@hendric: Thanks for updating it for easier read. Would be great if one could put some graphical screenshot as step by step instead of just having text all the way. :)

@servvs:
This thread is on the blender export script. It seems you are using the blender import script. Hence it's not really related to this thread.

Anyways, to answer your question, the import script imports .mesh.xml files and NOT .mesh files. If you read the error message carefully you will notice it's mentioned that there's no mesh.xml file. The script was designed to automatically execebute the XMLConverter if no mesh.xml was found. However the path setting is hardcoded in the script itself. Hence the converter wasn't found and hence you can't load anything up.

Secondly, your issue with things getting too small or too thin is due to the importer doing a scale down of all imported mesh by 10x.

To fix this issue, you have to open up the ogre_import.py script and fix the following properties:
IMPORT_SCALE_FACTOR and IMPORT_OGREXMLCONVERTER.

So in short, nothing wrong with exporter. It's pretty much an importer quirk since it wasn't designed to be part of the exporter nor has any relation to it. ;)
servvs
Gnoblar
Posts: 2
Joined: Mon Nov 02, 2009 6:25 am

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by servvs »

Well, I think it is related to the export script. The author of the import script fixed the scale down issue. My problem isn't scaling down, its scaling up. Its much larger all around. It becomes too wide and about 5x the size of the original model. I got rid of the error I was having before, but now the scale issue is arrising again. The reason I say its not the importer is I am also loading the model in torchlight (a new game). It looks the same as it does when I import it back into blender as it does in the game. Any ideas?
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Sounds like you forgot to apply the scaling and rotation in blender. Try do ctrl-A on your mesh before export. The exporter exports the original mesh without the scaling and rotation info in blender.
Smuel
Kobold
Posts: 37
Joined: Sat Oct 03, 2009 5:49 pm

Apply modifiers option?

Post by Smuel »

Hi. I posted this before in the feature request forum, but was directed here instead.

I was wondering if there were any plans to add an "Apply modifiers" option to the Blender export script. I have quite a lot of objects to export, and most of them use the EdgeSplit modifier to get sharp edges in the mesh, and it's annoying to have to save the .blend file, then go through every object applying the modifier by hand, then export, and finally re-load the saved .blend to undo the modifiers. It would be great if there was an "Apply modifiers" option in the export script that I could enable - then I would just have to select my objects and click on export.

Perhaps there is an easy workaround that I have missed, like a way to apply the modifiers on several objects at once, but I haven't been able to find anything.

Or maybe the script already has something equivalent to this feature and I've missed it. But if it doesn't then would it be possible to add something like that? Thanks.
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Hmm ok. This is a decent request. I did hit this issue myself. I'll have a look into this. :)
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by cyrfer »

@Smuel: I've also hit this issue. The FLT importer currently adds a lot of these modifiers to my models. However, I was trying to use the FLT importer to import multiple models which could be used for Shape animation, and the FLT importer re-orders and creates new vertices so I had to bail on using the FLT import for Shape animation in Blender.


@lf3thn4d: I'm stuck on a couple of problems for creating game resources in Blender that you might be able to imagine a solution to. I want to have car models in which I animate the Ogre SubEntity for the brake lights, turn signal lights, and head lights. On each car model, I need a way to identify this SubEntity in code. I see that SubEntities can be retrieved by a name, and also by iterating over all SubEntities and checking if they use a specific material. I'm currently using the latter technique because I don't see a way to enforce a name for the SubEntity in Blender. I tried separating my model into different named 'vertex groups' in Blender, but that didn't divide the Ogre Mesh into SubMeshes as far as I can tell. The problem with finding a SubEntity with a matching material name is that I'd like to identify the SubEntity of interest for each car model with the same material name, "brake_lights" (for example), and Ogre wont' let me have more than one material with the same name. Do you have any suggestions?
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

Hmm.. this is quite an issue. I'm not quite sure if it'll be an easy fix. But the best solution is to figure a way to export the vertex group's name as the sub entity name. However, I'm not familiar with the mesh export code so i'm not sure if this is going to be easy or not. Nevertheless, I'll have a look into it as well. ;) I can see this need for many stuffs including proper submesh splitting by artist for facial animation.
jblovloss
Halfling
Posts: 42
Joined: Sat Nov 07, 2009 6:59 am
Location: USA
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by jblovloss »

Got a problem I asked in the main forum, but just in case...


Can a bazillion ""WARNING - Vertex without bone assignment"" messages explain why ogre crashes on me when i try to load in a .skeleton file generated by this script?

I'm REALLY new to animation. Do I need to look into how to do weight painting to export to ogre, or is something else missing? The assertion I got was: SrcElemPos && srcElemBlendIndices && srcElemBlendWeights && "You must supply at least positions, blend indices and blend weights"

So positions, blend indices and/or weight are missing I guess. I'm assuming since I didnt weight paint at all, its weight... I used envelopes to make it animate right in blender.
Come visit me at Bit Bards: http://www.bitbards.com
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

The exporter does not support the envelope modifier. You have to do manual weight painting. Also, each vertex can only have a maximum of 4 bone weights. This is the main reason why envelope cannot be used since there's no way to control bone weight limit properly.

Have a look at this on how to weight paint: http://www.blender3dclub.com/index.php? ... cle&sid=21
jblovloss
Halfling
Posts: 42
Joined: Sat Nov 07, 2009 6:59 am
Location: USA
Contact:

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by jblovloss »

lf3thn4d wrote:The exporter does not support the envelope modifier. You have to do manual weight painting. Also, each vertex can only have a maximum of 4 bone weights. This is the main reason why envelope cannot be used since there's no way to control bone weight limit properly.

Have a look at this on how to weight paint: http://www.blender3dclub.com/index.php? ... cle&sid=21
Ohh, i see, because their radii might intersect. That actually makes a lot of sense. Anyway, problem solved. My little guy is moving around beautifully in Ogre3D. Thank you so very much for your quick response!
Come visit me at Bit Bards: http://www.bitbards.com
User avatar
lf3thn4d
Orc
Posts: 478
Joined: Mon Apr 10, 2006 9:12 pm
x 12

Re: Latest Blender Export Script [Tue Mar 24, 2009 - v1.2]

Post by lf3thn4d »

You're welcome. :)

On the side note, I've looked into the apply modifier option and figured that it's quite simple to add. There's a catch with this feature though. That is that some modifier will screw up vertex ordering due to addition/removal/sorting of vertices. This will mess up any vertex morph animation. So user has to use with caution.

However, the submesh name issue is not that simple. The problem was that vertex grouping doesn't really link one to one with ogre submesh. Ogre submesh is designed to group vertices of the same material together. Aside from this, vertex grouping is also used for armature bone weighting. Hence this feature is totally inapplicable for submesh naming. I see no way to solve this through blender. This is probably better done through an in-house mesh editor that can alter submesh grouping and naming.

[edit]
Updated new release with apply modifier option.
[/edit]
Post Reply