Blender26 Ogre Exporter

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Blender26 Ogre Exporter

Post by hartsantler »

Development taken over by OgreCave and moved to github
(this version supports Blender 2.76)
https://github.com/OGRECave/blender2ogre


Old Download: supports Blender 2.65
. http://blender2ogre.googlecode.com/file ... -0.5.9.zip

Download: requires Blender 2.63 or newer
. http://blender2ogre.googlecode.com/file ... -0.5.8.exe (automatic installer with automatic updates search)
. http://blender2ogre.googlecode.com/file ... -0.5.8.zip (standard addon, to be manually installed)


Installing:
. see README.txt
. jMonkeyEngine users do not need to install OgreCommandLineTools

Ogre Exporter Features:
. http://code.google.com/p/blender2ogre/w/list

Known Issues:
. previews in OgreMeshy will not show object-level scaling, rotation, or location
. make sure objects with an Armature have zero scaling, the mesh should also be a child of the Armature.
. the root bone should not have any rotation in edit mode (its straight up and down)
. live streaming may not work with the latest RealXtend (Tundra)

Whats New:
. library linked groups will auto-merge into a single mesh
. ogre-dot-material script inheritance
. one-click-preview in RealXtend Tundra2
. supports all collision types of Tundra2 (saves .txml format)
. eight pass material layers
. normal maps and per-pixel shaders
. real-time streaming of object location and scale into RealXtend Tundra2
Last edited by hartsantler on Mon May 27, 2013 2:56 am, edited 37 times in total.
odracoon
Gnoblar
Posts: 3
Joined: Tue Nov 16, 2010 6:15 pm

Re: Blender25 Ogre Exporter + extended .scene format

Post by odracoon »

Hey, thanks for the contribution ^^
Just wanted to ask for something, its not very important, could you ident the xml output? The idea of xml is to be human readable. But without identing it looks like a big confuse line of text.
Thanks.
PS: Adding userdata would be nice too ^^
Last edited by odracoon on Fri Nov 19, 2010 1:53 pm, edited 1 time in total.
mindrones
Gnoblar
Posts: 1
Joined: Fri Nov 19, 2010 1:31 pm

Re: Blender25 Ogre Exporter + extended .scene format

Post by mindrones »

Hi hartsantler, in case you want to have this included in our addons system, please consider to upload this script on out Py Scripts Upload trackers in the Extensions page!
Have a read at http://wiki.blender.org/index.php/Dev:Py/Sharing, and also, please feel free to drop in #blenderpython to discuss any doubt!
Keep up, cheers!
Luca (mindrones)
makiolo
Kobold
Posts: 25
Joined: Tue Feb 19, 2008 1:55 pm

Re: Blender25 Ogre Exporter + extended .scene format

Post by makiolo »

good work !
User avatar
SunSailor
Gnoll
Posts: 699
Joined: Sun Jan 02, 2005 5:45 pm
Location: Velbert, Germany
x 2
Contact:

Re: Blender25 Ogre Exporter + extended .scene format

Post by SunSailor »

Great work. What Ogre would need is a framework build upon Ogre and the .scene format, where one can export a whole animated scene and it runs out of the box in the framework - including ways to control the animation from code. But this seems to be a promising first step in such direction.
Online-Distribution with Jade-DS, Ogre-Wrapper included.
Follow me on Twitter for updates!
GenesisRage
Halfling
Posts: 73
Joined: Sun Dec 14, 2008 4:25 am
x 3

Re: Blender25 Ogre Exporter + extended .scene format

Post by GenesisRage »

cant seem to get this working with 2.54 or 2.55 (64-bit windows)
ive tried the xml converter from CommandLineTools (as install instructions say) and from 1.7.1 and 1.7.2 SDK releases
(error removed)
i have tried several different exporting options, and tried to make sense of the source... but alas im lost :(

EDIT: i changed the filename of the xml mesh created from base.xml_mesh to base.xml and manually running through exporter works

EDIT v2: dabbled in the source a little more and came to a conclusion that should work out... basically i modified filenames to match their counterparts in the 2.49 exporter

Code: Select all

@948
xmlfile = os.path.join(path, '%s%s.mesh.xml' %(prefix,name) )

@1055
xmlfile = os.path.join(path, '%s%s.skeleton.xml' %(prefix,name) )

@1143
if infile.endswith('.mesh.xml'):
    outfile = os.path.join(path, name.split('.mesh.xml')[0]+'.mesh')
elif infile.endswith('.skeleton.xml'):
    outfile = os.path.join(path, name.split('.skeleton.xml')[0]+'.skeleton')
p.s. why isnt this in the Artists & Content Creator section?
IRC Nick: Jake-GR
Netich
Halfling
Posts: 40
Joined: Tue Oct 06, 2009 8:52 am

Re: Blender25 Ogre Exporter + extended .scene format

Post by Netich »

Nice work!

I expect a good amount of sinergy between Ogre and Blender2.5, and this exporter should be the catalyst that make that sinergy start to shine.

I'll keep an eye in this thread.
GenesisRage
Halfling
Posts: 73
Joined: Sun Dec 14, 2008 4:25 am
x 3

Re: Blender25 Ogre Exporter + extended .scene format

Post by GenesisRage »

only issues i have run across is the OgreXmlConverter not liking .xml_mesh files as import (which i made a work-around in my last post)
but the export process is extremely slow and causes blender to report to windows it crashed (if i dont touch it, it eventually finishes)
here is some test numbers i had comparing the 2.49 exporter with the same model (3281 quads):

Code: Select all

Blender   XML Size   Export Time
2.49      3MB        6 seconds
2.55      7MB        6.8 minutes
IRC Nick: Jake-GR
Netich
Halfling
Posts: 40
Joined: Tue Oct 06, 2009 8:52 am

Re: Blender25 Ogre Exporter + extended .scene format

Post by Netich »

Is it possible to export more than one texture channels into the material?

I have a model with color, bumpmap, and AO baked textures, and only the color one is exported.

Maybe it could be a future feature...
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

I have posted a new version on google code 0.1.6 http://code.google.com/p/blender2ogre/d ... -0.1.6.zip with a number of fixes. Mostly importantly armature animation should now be working, seem to still have some issues though, want to get some feed back about problems anybody is having with armature animation. Note you do not need to bake the animation anymore, like in the old 2.49 exporter.
-brett
GenesisRage
Halfling
Posts: 73
Joined: Sun Dec 14, 2008 4:25 am
x 3

Re: Blender25 Ogre Exporter + extended .scene format

Post by GenesisRage »

maybe i am modelling something wrong?
i have an object that has different materials assigned, when i export the .material has the right info, but the model only shows the primary material?
EDIT: yup it was how i modeled it, but with OgreMeshy it only exports one material for preview.material
IRC Nick: Jake-GR
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

new version fixes smooth normals, and uv texture seams.
http://code.google.com/p/blender2ogre/d ... -0.1.9.zip

has anyone tested the .scene output? i am getting reports that objects are not in the right location and are alway at the zero point?

Genesis, i will look into multiple mats in OgreMeshy, next version it will be fixed if there is a bug.
-brett
GenesisRage
Halfling
Posts: 73
Joined: Sun Dec 14, 2008 4:25 am
x 3

Re: Blender25 Ogre Exporter + extended .scene format

Post by GenesisRage »

@hartsantler: i dont think its a bug with meshy, its just when clicking the button it only exports one mat into the preview.material file
im more interested in the speed of the exporter, even exporting simple static models is extremely slow (and reports to win7 that it crashed, if you wait a couple mins it will finish though)
IRC Nick: Jake-GR
lunk
Gnoblar
Posts: 1
Joined: Thu Dec 02, 2010 12:05 am

Re: Blender25 Ogre Exporter + extended .scene format

Post by lunk »

I don't know if it's the exporter or something else but I can't flip my normals on a test cube I want to export.
I want the texture to be inside of the box rather than outside (default).

But when I export it and import it into Ogre I see the texture on the outside but nothing (complete darkness even with light inside) when I move into the box.
Is there something I need to do in the code to make it work?

I've tried to flip the normals in Blender, but nothing happen in neither the material or mesh file.

Edit: Sorry, I totally missed the tangent options in the exporter. It now works completely fine. Thanks for this awesome tool.
odracoon
Gnoblar
Posts: 3
Joined: Tue Nov 16, 2010 6:15 pm

Re: Blender25 Ogre Exporter + extended .scene format

Post by odracoon »

Hey pal, user data option please?
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

odracoon, sorry for the late reply - busy lately :) 1. The xml output is indented, maybe the line endings are unix format, but if your on windows it should have given you windows newlines. 2. what user data do you want and where do you want it? You must be refering to custom-attributes, so this will be defined as new xml elements underneath <node> ?

mindrones, once we get a stable version working, then i will post on the blender site, and its great if it gets shipped with blender as an addon. Although the user still has to download OgreCommandLine tools, too bad there is not a pure python implementation of their binary format.

lunk, nice that you found that tangent option, i wasn't even aware of what it did, maybe that should be checked by default so as not to confuse others - will make it so in next version.

GenesisRage, there is nothing else i can do to make the script run any faster (unless Blender ships with a compiler and starts supporting Cython (i wish they did!)). My guess is that the slowness is not in my script though but rather in OgreCommandLineTools. Perhaps we can launch OCLT in a non blocking subprocess, but you have to wait for those .mesh files anyways for anything useful. Why don't you just export and take a break and walk around :) I tested multiple mats on a single object with OgreMeshy preview and i can see both mats, so maybe your not running the latest version. (i've had reports of people having problems updating the addon, better to delete the old one first)

How come nobody is testing the support for custom shaders? You guys must have missed these youtubes i made:
http://www.youtube.com/watch?v=Sn2Zhh72emk
http://www.youtube.com/watch?v=xYJOzWg1sJA

thanks for the feedback,
-brett
TyisBeast
Gnoblar
Posts: 3
Joined: Mon Dec 06, 2010 6:54 am

Re: Blender25 Ogre Exporter + extended .scene format

Post by TyisBeast »

Thank you so much for releasing this, it has pretty much solved all of my problems. I couldn't get the Ogre Exporter on the download page to install to Blender 2.5 so I had been using the old one. Was googling around because I was having trouble exporting a scene with multiple meshes and was getting frustrated.

It seems that your Addon is exporting the meshes as .xml_mesh, I added the ogre command line tools to C:\OgreCommandLineTools and added them to the system path. Not sure if there is an option or something that I'm missing or a configuration page where I can set up the path. I tried to manually send some of the xml meshes to ogrexmlconverter.exe but it won't accept the file unless its a .xml, which would mean renaming about a hundred files. Any tips on what I should do to get it to export straight to a .mesh? Thanks in advance.
GenesisRage
Halfling
Posts: 73
Joined: Sun Dec 14, 2008 4:25 am
x 3

Re: Blender25 Ogre Exporter + extended .scene format

Post by GenesisRage »

hartsantler: dont mean to be rude, but i ran some tests and its not the converter
what i did find out, is the exporter writes the entire vertex list in each submesh. so if you have 5 submeshes (like different materials), and you have 5k total verts (submeshes combined), it writes all 5k verts in each submesh tag. i ran some smaller models, and in the submesh entry there are verts that are not used in its face entry.
i really do believe that is one reason it seems slow (at least to me), another thing i noticed the vertex position values are exported to the 12th decimal point, where the official 2.49 exporter only goes 6 decimal points. yes this has more accuracy, but given the if you model 1 unit = 1000 Km, it still has the precision of 1/1000th of a mm
either way i will be looking into the exporter some more, see if i can decipher what is going on and where, and keep you informed if i find anything.
IRC Nick: Jake-GR
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

TyisBeast, if you are getting .xml_mesh files then you are running the old version that contains that bug. Get the latest below
http://code.google.com/p/blender2ogre/d ... -0.1.9.zip

GenesisRage, i'm glad you ran those tests and found that flaw in my code. Ogre mesh xml format supports something i think its called sharedvertexbuffer which i set to false, so yes it means that each material (each submesh) gets written many times and that is a big waste. I will optimize this and lets compare how much faster it can be. If its still slow i suppose we can drop the decimal places. Cheers!
TyisBeast
Gnoblar
Posts: 3
Joined: Mon Dec 06, 2010 6:54 am

Re: Blender25 Ogre Exporter + extended .scene format

Post by TyisBeast »

Thanks for the reply, I actually thought I had updated it but it was still reading from the previous script file. I'm having a different problem now that is probably just user error but I'm basically trying to export a google sketchup file by exporting it from google sketchup to a .3ds, then importing that file into blender and then using the Ogre exporter to create the meshes etc. I actually got this method to work by exporting the meshes into a scene file and loading it as a scene, but I want to load the mesh file as an entity instead of a whole .scene terrain so I tried to join all the meshes together (Ctrl+J) and then export it into a single mesh which would be easier to handle. The mesh I want to export is a transformer and has around 800 smaller meshes inside it. Before when I exported it as a scene it took around 10-15 seconds and it was done and I loaded it into my project as a scene file, now when I try to export it as a single mesh it seems to be processing it but it just takes forever. I have let this job process for at least 4 hours now and my CPU usage from blender has been constantly up so I know its doing something but its just a frozen blender screen right now. I'm running a Phenom X6 (six cores) at 4.0Ghz so it doesn't seem like it should take this long? I'm a newbie at this so I'm probably just doing something wrong.
GenesisRage
Halfling
Posts: 73
Joined: Sun Dec 14, 2008 4:25 am
x 3

Re: Blender25 Ogre Exporter + extended .scene format

Post by GenesisRage »

@TyisBeast: if you look at my previous posts, and hartsantler's the exporter is currently exporting every vertex in the model for each submesh. so for the time being its not very efficient handling submeshes
IRC Nick: Jake-GR
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

TyisBeast, im sorry you had to go through that, the first issue is fixed, submeshes are optimal now only using a single vertex buffer. There is a second issue with smooth normals. See the FAQ in the online help (ogre help - far right toolbar). The 2nd issue is just as bad as the first, i won't go into the details, basically if you want your export to be 100x faster set your dense objects to be flat shaded. Hopefully this 2nd issue gets fixed in the future.

http://code.google.com/p/blender2ogre/d ... -0.2.0.zip
TyisBeast
Gnoblar
Posts: 3
Joined: Mon Dec 06, 2010 6:54 am

Re: Blender25 Ogre Exporter + extended .scene format

Post by TyisBeast »

Even after messing with the shading properties etc, I still was not able to get it to export after joining the meshes. I finally found out about the mesh combining option in meshmagick and this solved all of my problems, I can now join all of the meshes together to create my entity. Otherwise the addOn works wonderfully and now automatically converts the xml files to meshes :D .

Thanks for all the work you put into this, so glad I can use Blender 2.5 instead of the older one since a lot of the new tutorials are made for the new blender. Your awesome! :D
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

TyisBeast,
maybe you can help me test this new version, i have integrated MeshMagick, any objects you put in a group named starting with "magicmerge" will be post processed by meshmagick. (this only works with the OgreMeshy preview button)
Another method of automatic merging uses blender's join behind the scenes. Any objects you put in a group named starting with "merge" will be joined into a single mesh on export. (this works properly from ogremeshy preview, it also works from the export ogre-dot-scene but there is a bug where the file gets written multiple times).
Note that i didn't seem to have much luck with meshmagick, it seems like it combines the meshes by matching vertex numbers, which is odd for most cases right? I was expecting something like appending the mesh. Thats why i wrote the other merge method that happens in blender before .mesh.xml files are saved.

http://code.google.com/p/blender2ogre/d ... -0.2.1.zip

odracoon, i added support for custom attributes, any custom props you put on objects will be exported to the ogre-dot-scene file under the node element in elements name user_data. It contains attributes: name, value, and type. Of course its up to your engine programmer to then implement their loader to do something with the extra data.
hartsantler
Greenskin
Posts: 107
Joined: Tue Nov 16, 2010 7:33 am
x 15

Re: Blender25 Ogre Exporter + extended .scene format

Post by hartsantler »

I have extended the ogredotscene format to include a limited subset of Sensors and Actuators from blender-game-engine. See the blog post below.
http://pyppet.blogspot.com/2010/12/ogre ... e-bge.html

Also fixed the auto-merge-meshes (in a group named "merge") so that it works properly now.
http://code.google.com/p/blender2ogre/d ... -0.2.2.zip
Post Reply