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
racoon
Gnoblar
Posts: 15
Joined: Fri Jul 23, 2010 6:34 pm

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by racoon »

Hi guys,

first I have to thank you for the great Blender Exporter.

I have a small problem and I don't know if it has anything to to with the exporter or not.
I am converting an .obj file to a .mesh.xml file using the blender exporter.
Then I am using the OgreXMLConverter to convert it to a .mesh file. (# OgreXMLConverter lucy.mesh.xml)

When I load the mesh in Ogre and use a vertex and fragment shader to access the vertex normals I found out that they are per-face and not per-vertex.
If I use another mesh like ogrehead.mesh everthing is fine (normals are per-vertex).

Do I have to do a special trick to get per-vertex normals???

Thanks

Sebastian

nitro3
Gnoblar
Posts: 6
Joined: Fri Jul 30, 2010 8:56 pm

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by nitro3 »

If this thread is still active.... for the first time i am getting this single error on exporting:

Error: Face(s) without material assignment in obj "...

I searched the fourms and ppl who mentioned this error say there is a easy manual fix for this, but on one really goes into describing how to fix it "manually". Some help would be appericiated.

User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by koirat »

This error says it all. Do you have materials assigned to all your objects ? If you don't assign material default "BaseWhite" is going to be used but the Error will pop.
This is a block of text that can be added to posts you make. There is a 255 character limit.

nitro3
Gnoblar
Posts: 6
Joined: Fri Jul 30, 2010 8:56 pm

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by nitro3 »

thanks for the quick reply,
so after much fustration of trying to peek at each face in my model, i did lots of test cases,
:: model + no uv tex + no blender material
:: model + uv tex + no blender material
:: model + uv tex + blender material
and so on..
it turned out that none of the cases solved the problem!.
However, what SOLVED the problem and worked for ALL CASES was changing the exported material from "Rendering Materials" to "Game Materials" . Very peculier! know why that is happening?

On a side note. If i add a bump/normal map in the blender material for an obj, would the generated .material have a link to the bump map? that is when i load+render the entity in ogre i will see the bump map magically applied to my model ?

thanks

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by jacmoe »

nitro3 wrote:However, what SOLVED the problem and worked for ALL CASES was changing the exported material from "Rendering Materials" to "Game Materials" . Very peculier! know why that is happening?
Yes, that's what I do too.
Another great thing about game materials is that you'll see it directly in Blender.
nitro3 wrote:On a side note. If i add a bump/normal map in the blender material for an obj, would the generated .material have a link to the bump map? that is when i load+render the entity in ogre i will see the bump map magically applied to my model ?
Unfortunately no.
I usually export a very basic material, and then tweak it afterwards.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

reptor wrote:Blender 2.5 (alpha edit: oh it's beta now, as of today) uses Python 3 which can mean that the scripts have to be modified. Has anyone checked the situation on that yet?
Yes, I'm still keeping an eye on it. ;-) Looks like their UI part of the python api is considered pretty stable. I'll probably look into building the UI part to get used to the new API first. Unfortunately the data api is still marked as unstable and due to change. So it will still be a while before I can work on a proper exporter.

censor
Kobold
Posts: 27
Joined: Sat Jun 19, 2010 8:18 pm
Location: Erie, PA

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by censor »

Thank you very much for the update! I have already installed Blender 2.53, but I will keep using my good old Blender 2.49b for the time being, for the exporting needs.

User avatar
Jason Rogers
Kobold
Posts: 32
Joined: Fri Apr 09, 2010 8:10 am

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Jason Rogers »

lf3thn4d wrote:Yes, I'm still keeping an eye on it. ;-) Looks like their UI part of the python api is considered pretty stable. I'll probably look into building the UI part to get used to the new API first. Unfortunately the data api is still marked as unstable and due to change. So it will still be a while before I can work on a proper exporter.
Music to my ears! :D

I have so many models i need to export! Thankyou for letting us know your on-the-case lf3thn4d :)
<MetalPig> a world without undo-redo is a world I dont want to live in.
<JayRogers> wish reality had an undo function.. the redo function seems to be working fine though, i can screw up as many times as i want.

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

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

You're welcome. I'm personally very excited with blender 2.5 too :D. Can't wait to wriggle myself off some free time to work on this.

User avatar
Svenstaro
Greenskin
Posts: 115
Joined: Fri Dec 15, 2006 1:30 pm
Location: Germany
x 3
Contact:

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Svenstaro »

Can't wait for the exporter :)

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1889
Joined: Sun Mar 08, 2009 5:25 am
x 107

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by mkultra333 »

Just noticed something, don't know if it's been mentioned already, since this is a very long thread.

I had a mesh and skeleton and a single "blank" animation, that was just the skeleton with a one keyframe pose. First thing to be wary of is that if you use the exporter, change the number of animation frames, and then use the exporter again, it doesn't update the anim length with the new number of frames. This isn't necessarily an error, but something users should be aware of. If you change the anim length, it's best to delete the anim from the exporter and then re-add it.

Next issue was that I was getting crashes from OgreXMLConverter.exe, it wouldn't output the skeletion. Turns out the problem was that it doesn't like single keyframe animations. So I added a second keyframe identical to the first, but it still crashed. It also doesn't like having just two keyframes that are identical. I added a tiny change to the second keyframe and it converted the file fine.

So, just thought I should mention that. Perhaps add something to catch this in OgreXMLConverter.exe (though perhaps the converter isn't your responsibility?) Or anyway, just something for modellers to be aware of.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by koirat »

The crash - Yes it was already mentioned. You can't just do one key frame animation.
This is a block of text that can be added to posts you make. There is a 255 character limit.

User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1889
Joined: Sun Mar 08, 2009 5:25 am
x 107

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by mkultra333 »

Thought I'd mention a couple of things, again, don't know if they've already been covered.

I was working on a model and animation, and was running into numerous problems. The scale and position of the mesh wasn't matching where they were in blender, and the anim was coming out weird. I thought I'd avoided doing any modifications or editing in Object mode, doing everything in Edit mode, but it was still wrong. Eventually found some things that fixed it up.

First, in Object mode, I used "Object > Clear/Apply > Apply Scale/Rotation to ObData" on both the mesh and armature. This fixed up the animation, don't know why.

Secondly, in Object mode, I did "Object > Clear/Apply > Clear Location" and "Object > Clear/Apply > Clear Origin" on both the model and armature, and then went to edit mode and re-positioned the mesh and armature. This fixed up the positioning issue.

I don't know how the bad data got in to begin with, I probably messed something up, but the above sorted it out.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by jacmoe »

Just a link to some good Blender 2.5 Python snippets:
http://www.blendernation.com/blender-2- ... -snippets/
Might help in porting the exporter? :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

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

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

Hey jacmoe, thanks for the link. I've already got a copy on my desktop. :-D I've actually did some digging into UI scripting for Blender 2.5. To my disappointment they have removed the script window. What this means is that we cannot have custom script UI on a standalone window space. The closest I found was to hack around the system suggested here: http://blenderartists.org/forum/showpos ... stcount=96. However, I think that is not a feasible solution since its an ugly hack that replaces whichever target window into a blanked out user preference window.

So most likely the exporter's UI will end up scattered around the Properties window. I'm open to any suggestion atm. Or if anybody want to help convince the blender guys to add custom script window support, all the better. :-P

User avatar
Jason Rogers
Kobold
Posts: 32
Joined: Fri Apr 09, 2010 8:10 am

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by Jason Rogers »

I'm not sure if this a valid suggestion or not as i have no clue about python scripting whatsoever, nor do i i know anything about the blender internals..

Also not -entirely- sure what you mean would happen by the UI being scattered around..

But anyway.. im gonna voice my idea regardless!

I'm basically seeing talk of a rough hack to hijack an existing window correct..? Well how about rather than hijacking an existing window, write something that could perhaps plug in to the existing window choices? By this i mean.. Each window has an option list which tells the window what it should be displaying, could you not create a custom option that could be added into this list when enabling the plugin? (thus there would be no "hijacking" of windows)

I dont know if my idea is a good/valid one or even if its possible, but i've voiced it nonetheless at risk of sounding stupid :)

And if your looking for opinions, well mine would be - Anything that works, no matter how confusing/complicated is better than nothing at all! :wink:
<MetalPig> a world without undo-redo is a world I dont want to live in.
<JayRogers> wish reality had an undo function.. the redo function seems to be working fine though, i can screw up as many times as i want.

User avatar
koirat
Orc
Posts: 446
Joined: Mon Feb 25, 2008 7:56 pm
x 13

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by koirat »

@lf3thn4d
Would you mind adding option that will check if the model got UV coordinates and convert it to mesh without "-t" even when"Tangent" button is pressed. Because now it is trying to convert mesh with "-t" and as a result OgreXmlConverter can't convert *.mesh.xml file created by exporter. It would be helpful when batch converting.
This is a block of text that can be added to posts you make. There is a 255 character limit.

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

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

@Jason Rogers: Yes, I did thought of that. But there are certain options that does not fit in existing windows. For example the xml converter options. Personally, they should provide a way to allow scripts to have their own window.

@koirat: That's a good point. I totally missed that. I'll see if I can get it fixed.

@joshuafitch1947: You're welcome. :)

cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by cyrfer »

So work has begun on a new export script for 2.5? That's great news. Maybe a new forum should be started so the community help give feedback on the different versions (2.49 might still be needed by some people).

What UI items are going to be scattered around? I basically want a button like 'ogre export now' near the scene properties and a few options about animations and mesh formats near the mesh properties. I agree with Jason Rogers about the 'anything is better than nothing' approach. I think the Blender community would be interested to see how "scattered" the UI looks for custom tools/options. Maybe they would be more interested to fix something if we had a working version that looked bad because of their design.

Is it going to be possible to have an interactive scene viewer? Support for something like that may need to be considered earlier rather than later. Is the source code shared for script development? With the data API stabilizing, we should be able to nail that one down soon, and make the UI pretty as time goes on. A progress bar would be cool too. ;)

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

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by lf3thn4d »

cyrfer wrote:So work has begun on a new export script for 2.5? That's great news. Maybe a new forum should be started so the community help give feedback on the different versions (2.49 might still be needed by some people).
Actually I've only been browsing and playing around. Nothing officially starting yet. Definitely we will have a new thread for this when it starts.
cyrfer wrote:What UI items are going to be scattered around? I basically want a button like 'ogre export now' near the scene properties and a few options about animations and mesh formats near the mesh properties. I agree with Jason Rogers about the 'anything is better than nothing' approach. I think the Blender community would be interested to see how "scattered" the UI looks for custom tools/options. Maybe they would be more interested to fix something if we had a working version that looked bad because of their design.
I'll try to work something out. My only concern is where to put the global settings. Stuffs like mesh settings could be made per mesh data which could be a good / bad thing. (E.G. Animation export settings would work. But tangent parity stuffs might not be a good idea? Depends on one's use case I guess.) Material settings like material template can be part of the material page as well. But this simply means users will have to go panel hunting to find ogre exporter's settings.

As for the export button, I'll probably place them in the tool shelf panel. Maybe global settings will go there as well.
cyrfer wrote:Is it going to be possible to have an interactive scene viewer? Support for something like that may need to be considered earlier rather than later. Is the source code shared for script development? With the data API stabilizing, we should be able to nail that one down soon, and make the UI pretty as time goes on. A progress bar would be cool too. ;)
I currently have no plans for an interactive viewer. For one, this is not a scene exporter. Also, the custom material template system means that the viewer will not have enough information to preview a WYSIWYG. The best we could do is have a hook with fixed command-line param for any custom viewer users want to attach to. Like how most tools does it with editing files in external text editors. I'll leave this to anybody who wants to help add support to it. But I think we shouldn't force a viewer as part of the script exporter. ;-)

The source code will be shared through Ogre's mercurial repository. I will provide more information when I start. Then anyone can chime in and help prettify/improve the UI as best they can. :-)

cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Latest Blender Export Script [Sun Nov 8, 2009 - v1.3]

Post by cyrfer »

lf3thn4d wrote: Actually I've only been browsing and playing around. Nothing officially starting yet. Definitely we will have a new thread for this when it starts.
OK I'm trying not to talk more about the new exporter in this thread...but my excitement makes it's hard not to. Your work on the exporter with blender < 2.5 set a new standard for free tool support in OGRE and blender > 2.5 will only make better support easier.
lf3thn4d wrote: My only concern is where to put the global settings. Stuffs like mesh settings could be made per mesh data which could be a good / bad thing. (E.G. Animation export settings would work. But tangent parity stuffs might not be a good idea? Depends on one's use case I guess.) Material settings like material template can be part of the material page as well. But this simply means users will have to go panel hunting to find ogre exporter's settings.

As for the export button, I'll probably place them in the tool shelf panel. Maybe global settings will go there as well.
I highly recommend allowing for both global and customized settings. In a professional exporter I've used, each setting has a default value of 'use global setting'. This implies that a UI exists for both the individual resource and the global resource values. For example, on the individual Mesh->tangent setting, options would include:
  • 'use global mesh setting'
  • 'use parity'
  • 'no parity'
lf3thn4d wrote: I currently have no plans for an interactive viewer. For one, this is not a scene exporter. Also, the custom material template system means that the viewer will not have enough information to preview a WYSIWYG. The best we could do is have a hook with fixed command-line param for any custom viewer users want to attach to. Like how most tools does it with editing files in external text editors. I'll leave this to anybody who wants to help add support to it. But I think we shouldn't force a viewer as part of the script exporter. ;-)
I can understand why you would avoid this feature. The WYSIWYG is very helpful to artists. However, it is probably very difficult to make WYSIWYG that is exactly the same as the export itself, without any bugs. When a bug exists, the artists are confused and frustrated. It's easier to avoid the whole issue and artists will probably be happy. I've used your code to implement my own scene exporter. It was very easy to integrate. I think a scene exporter is app-specific and would dilute the work you have been doing.
lf3thn4d wrote: The source code will be shared through Ogre's mercurial repository. I will provide more information when I start. Then anyone can chime in and help prettify/improve the UI as best they can. :-)
Excellent.

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 »

Thanks for the suggestions. That actually gave me some ideas. Perhaps splitting the UI all over the place won't be that big a deal after all. Just need to take time to get used to.

Btw, I've updated the exporter with fixes and some minor additional features. Check it out. :-D

I intend to work on adding support for exporting more than one vertex colour. However, I'm still not sure how to handle this properly. Ogre's format only accept 2 colour per vertex (Diffuse & Specular). Am thinking of falling back to UV when we have more than 2. However some users might want all colour to be in UV instead. Any suggestion on how to deal with this in the interface sense is welcomed. :)

zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

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

Post by zeromath »

I'm sorry if this is breaking the flow fof the conversation, but I have a problem:

When I export mesh objects they would shrink dramatically. I'm wondering if I need to do something in blender to stop them from shrinking, or if there's something I'm not doing in the exporter. This might not be a problem for most, but I'm working with a game engine from scratch and the programmer has to hard code the scaling, not to mention other things...If I try to scale the object up in blender, it still ends up shrinking when exported....

Any help?

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 »

@zeromath: You have probably scaled the blender "object". Verify this (N_KEY in 3D viewport I think), put the scale back to (1,1,1) and then you will see the true size of your Mesh. The Ogre Mesh exporter does not export the object "scale" info because it is not part of the mesh. Object transformations are usually part of a scene file.

zeromath
Gnoblar
Posts: 21
Joined: Mon Jul 05, 2010 5:19 pm

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

Post by zeromath »

Thanks for the reply, I now know a little more about how the exporter works. But when I opened properties (N) and change the scale properties to 1,1,1, the dimensions of the object changes. I would just scale the object, but the 1,1,1 changes as well.....

Post Reply