Blender26 Ogre Exporter

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

LBDude wrote:How do you correctly export multiple actions? Instead of read the ogre help re. the animation and NLA editor, I went ahead and created two actions. I then tried to create NLA strips after that, but only a single animation called "my_animation" was exported out. I then started messing around with the NLA editor and sometimes it would unlink my action, basically removing the action all together. It's pretty confusing.
that happens if you do not convert your action to a NLA strip by using the star symbol (or whatever it is). note that after doing this your animation is set in stone and if you want to change anything you have to redo it....

i put together a tutorial for myself so i can reproduce my exports, point 8 is where you have to convert to NLA.

https://docs.google.com/document/pub?id ... 9gPpSsCt4Y

maybe this document can help some others to get their animations working as well. if something is unclear or needs improvement or be removed, let me know.
Demarii
Gnoblar
Posts: 18
Joined: Thu Jan 26, 2012 2:58 am
Location: Canada
x 9

Re: Blender26 Ogre Exporter

Post by Demarii »

Actually you can edit an NLA track, you just need to select the track and with the Editor in focus press TAB, or use View -> Enter Tweak Mode

Good overview Doc on the overall process though, I think it will be a great help to those who have not gone through it yet.
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

Demarii wrote:Actually you can edit an NLA track, you just need to select the track and with the Editor in focus press TAB, or use View -> Enter Tweak Mode

Good overview Doc on the overall process though, I think it will be a great help to those who have not gone through it yet.

wohooo thanks for that info, i somehow knew it can not be possible that the strip is locked down:D i will change the doc when i got some time and see if i can fix the layout:O
User avatar
kromar
Gnoblar
Posts: 13
Joined: Tue Aug 23, 2011 12:52 pm
x 1

Re: Blender26 Ogre Exporter

Post by kromar »

hm can someone tell me how i can influence the length value? is that linked to something else than amount of frames?

this is in the skeleton.xml file

Code: Select all

<animation length="1.25" name="Action_Camera" >
EDIT: never mind, noticed that one of my scenes had 24 fps in the render settings which increases this length value:O
LBDude
Gnome
Posts: 389
Joined: Mon Jul 26, 2010 10:53 pm
x 22

Re: Blender26 Ogre Exporter

Post by LBDude »

thanks for the help! I actually found out my problem was that I was making my proxy mesh (already parented to bones) into NLA strips. What I need to do is import the actions from the bones instead. Doing so all the animations exported correctly.
My blog here.
Game twitter here
User avatar
frr171
Gnoblar
Posts: 4
Joined: Thu Oct 07, 2010 2:39 am
Location: Chandler, Arizona

Re: Blender26 Ogre Exporter

Post by frr171 »

I have a mesh in blender, with different textures applied to different faces. I remember in older versions of the blender exporter, there was an option called Game Engine Materials, or something of the like that would automatically create the material script with an individual material for each texture. I can't seem to find the equivalent option in the newest version of the exporter. Is there a way to accomplish the same task, or has this feature been depreciated.
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

I think the option doesn't exist in the exporter because there is no need to turn it off in any situation. the script should automaticly export the mesh with different sub-meshes for each material you have defined in blender and assign the materials to the corresponding sub-meshes. You have the option to export the different materials to seperate .material files or one big.
Though as always the material files writen by the exporter are very basic ones, but you should be able to modify them to your own personal needs afterwards.
pwr00
Gnoblar
Posts: 21
Joined: Sat Apr 23, 2011 7:19 pm

Re: Blender26 Ogre Exporter

Post by pwr00 »

Hi!
I hope that this is the correct thread to ask questions about how to use ogre2blender. The thing is that I have created a backpack in blender having origo in the base of the mesh. I want to connect this backpack to the back of my player character in game. I have attached the backpack by using a bone that is located in my character armature. The problem is that I don't want to connect the bone to the origo of the backpack, since that makes the backpack transform in a way that makes it transform wrong. What I tried is adding a armature to the backpack and hoping that I could add this backpack aramture to the character armature when attaching the backpack. My biggest problem is that blender2ogre needs the root node not to be transformed. That makes it hard for me to create an armature that I can use for my backpack, since it has the origo in the base of the mesh. So my question is actually, am I missing something? Is there a lot simpler way to attach a mesh to a skinned character? I know that this question is borderline ogre and not really blender2ogre. But I'm hoping that some kind soul here have done something similar and managed to export it with blender2ogre.
(the backpack needs the origo in the base of the mesh to make it possible to place it on the ground easy)

I also want to say thanks for blender2ogre. It works really well for me otherwise and have helped me a lot.
pwr00
hymerman
Halfling
Posts: 66
Joined: Wed Dec 20, 2006 10:15 pm
x 1
Contact:

Re: Blender26 Ogre Exporter

Post by hymerman »

Try giving the backpack an armature with the root bone at the origin, and with a single bone at the attach point, which I'll call the character-attachment-bone. Then in game, attach the backpack to the backpack-attachment-bone of the character, but with an offset given by the character-attachment-bone of the backpack. I can't remember if there's a way to do that directly, but you can certainly do it by creating an intermediate SceneNode in the hierarchy with translation equal to the character-attachment-bone's position. Does that sound sensible?
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

With the newer version of the script you should no longer need to have the root-bone at the origin.

The standard way of attaching equipment to a character is to attach it to a bone. Either with a constant offset to an existing bone (in your case maybe the spine) or by creating extra non-deformable bones just for the purpos of attaching equipment to them which then can be moved in your animation to move the attached equipment in any way you like.
The Sindbad character for example has extra bones at the sheaths on his back to properly place the swords in them when they are not drawn.
The newest version of the exporter allows you to not export non-deformable bones to hide bones that are used for inverse-kinematics in blender but you can force single bones to be exported by giving them a custom property named "Force_Export" to ignore ik-bones but export bones that are meant to attach equipment to them.

A skeleton for the attached object should only be needed if you want to animate it on its own (for example a chainsaw that can rotate on its own)
efaj
Gnoblar
Posts: 21
Joined: Tue Dec 27, 2011 2:00 pm
x 2

Re: Blender26 Ogre Exporter

Post by efaj »

Does this exporter not support "Volume" material type? I have a cloud mesh that I can't get to work correctly...
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Re: Blender26 Ogre Exporter

Post by saejox »

how do you guys rotate an existing rigged model?

skeleton is not rotated correctly no matter what i do :(
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

@efaj: The exporter uses the tundra material-scripts to write the material scripts. if you don't use them it will just create a default-material script that applys every texture as a color-map. This normally means that you have to write your own material scripts. From what I know blender's material settings are very different from Ogre's and it's quite dificult to get the exporter create useful materials.

@saejox: blender works with different coordinate-systems like Ogre does. If you built an object in edit-mode, you change the positions of the vertices in the object's local coordinates. If you later translate or rotate an object in object-mode you simply move the object in world-space without changing its local coordinates.
The editor only exports the local coordinates and ignores any global transformation. unfortunatly in Blender a skeleton and the mesh it is attached to can have different global transformations and take these into account when deforming the mesh.
The easy solution to this is move the skeleton in object-mode until it 'looks like' it is placed correctly, then press shift+a to apply location, rotation and if neccessary scale. this will set the global transform to zero and recalculate every local transformation to match the view. (apply this to both, skeleton and mehs)
efaj
Gnoblar
Posts: 21
Joined: Tue Dec 27, 2011 2:00 pm
x 2

Re: Blender26 Ogre Exporter

Post by efaj »

Waruck wrote:@efaj: The exporter uses the tundra material-scripts to write the material scripts. if you don't use them it will just create a default-material script that applys every texture as a color-map. This normally means that you have to write your own material scripts. From what I know blender's material settings are very different from Ogre's and it's quite dificult to get the exporter create useful materials.
Googling "blender tundra material scripts" and some permutations.... nothing useful appeared.... can you elaborate or link me to some place to learn more about how to do such scripts?
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

the point is that you don't use blender's own material at all, but write your own ogre-material script.

you can learn about ogre-materials in the manual: http://www.ogre3d.org/docs/manual/manual_14.html#SEC23

and you can have a look at some sample/template materials in the wiki: http://www.ogre3d.org/tikiwiki/Materials
User avatar
saejox
Goblin
Posts: 260
Joined: Tue Oct 25, 2011 1:07 am
x 36

Re: Blender26 Ogre Exporter

Post by saejox »

Waruck wrote: @saejox: blender works with different coordinate-systems like Ogre does. If you built an object in edit-mode, you change the positions of the vertices in the object's local coordinates. If you later translate or rotate an object in object-mode you simply move the object in world-space without changing its local coordinates.
The editor only exports the local coordinates and ignores any global transformation. unfortunatly in Blender a skeleton and the mesh it is attached to can have different global transformations and take these into account when deforming the mesh.
The easy solution to this is move the skeleton in object-mode until it 'looks like' it is placed correctly, then press shift+a to apply location, rotation and if neccessary scale. this will set the global transform to zero and recalculate every local transformation to match the view. (apply this to both, skeleton and mehs)
i always apply rot/lot/scale to skeleton. thinking mesh is its child it should apply to its children too.
does not apply to children.

thank you for opening my eye :)
Nimet - Advanced Ogre3D Mesh/dotScene Viewer
asPEEK - Remote Angelscript debugger with html interface
ogreHTML - HTML5 user interfaces in Ogre
User avatar
Whitedwarf
Gnoblar
Posts: 3
Joined: Tue Sep 04, 2012 7:00 pm

Re: Blender26 Ogre Exporter

Post by Whitedwarf »

First of all I would thank you for the great tool blender2ogre and all users for their effort and help. As a beginner in 3D using blender and the Blender2Ogre exporter I have trouble in viewing exported animations with ogremeshy. After exporting any mesh with an armature ogremeshy locks up with an appcrash of ogremeshy.exe in ogremain.dll. Without an armature it works fine. I'm trying now for a week to solve this problem an read all post but I never found this special problem. It would be great if anyone has a guess in solving this problem. Perhaps I made a mistake in connecting the armature to the mesh or it is a problem with ogremeshy. You can find a test.blend (simple cube as a child of an armature without keyframes) with the link below. Even this file will locks up ogremeshy after exporting. Exporting blender file to ogre format reports no errors.
Thanks for your help. :!: and sorry for all mistakes I made because I'm a rare forum user.

test.blend

Here all facts of versions and system:
Windows Vista Home 32bit
Blender 2.63.0
Blender2Ogre - 0.5.7 preview2
OgreMeshy 1.4 (installed in C:\)
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

Re: Blender26 Ogre Exporter

Post by LiMuBei »

Can you provide the export files of that test scene? Also, does the log file of Ogre Meshy provide any useful info?
User avatar
Jefferian
Halfling
Posts: 63
Joined: Sun Jun 12, 2011 12:53 am
Location: Italy
x 1

Re: Blender26 Ogre Exporter

Post by Jefferian »

Do anyone else got problems of "BAD_SUBMESH" while importing with Blender 2.63 (and the last version of the exporter, of course)?
I've got two objects in the same scene. I can export one of those (a block notes) but not the other (a bowl). So...have i done something wrong i'm not aware of or this is due of the changes they've done with Blender 2.63?
Cause if it is a matter of versions, i could switch back to another one and redo those meshes anew. Annoying, but i can't see any other solution as now.
User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
x 80
Contact:

Re: Blender26 Ogre Exporter

Post by duststorm »

If you want to try moving your meshes to Blender 1.62, and they are just static meshes, try exporting to wavefront .obj and then importing them in the older blender. Who knows, maybe you get identical results.
If Obj doesn't suit your needs, you could try other formats, like collada.
Developer @ MakeHuman.org
User avatar
Whitedwarf
Gnoblar
Posts: 3
Joined: Tue Sep 04, 2012 7:00 pm

Re: Blender26 Ogre Exporter

Post by Whitedwarf »

LiMuBei wrote:Can you provide the export files of that test scene? Also, does the log file of Ogre Meshy provide any useful info?
Thanks LiMuBei for your help.
OgreMeshy does not report errors, only one warning. But I got this always also on well working 3D objects without armature.

Here the log:
Parsing scripts for resource group InternalMeshGroup
Parsing script Test.material
Finished parsing scripts for resource group InternalMeshGroup
Creating resources for group InternalMeshGroup
All done
Mesh: Loading Cube.001.mesh.
Skeleton: Loading Cube.001.skeleton
WARNING: Cube.001.mesh is an older format ([MeshSerializer_v1.41]); you should upgrade it as soon as possible using the OgreMeshUpgrade tool.


Here are the exported files converted with Blender2Ogre
test.zip

Perhaps you are really able to walk over water :D
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

your boneassignment is completly empty. none of your vertizes are assigned to any bone. That seems to crash Meshy. Giving any vertex a value greater than 0 should fix your problem.

Not sure if this should be considered as a bug in the exporter since exporting a skeleton for a mesh that doesn't influence it in any way doesn't make any sense at all.
User avatar
Whitedwarf
Gnoblar
Posts: 3
Joined: Tue Sep 04, 2012 7:00 pm

Re: Blender26 Ogre Exporter

Post by Whitedwarf »

Thx Waruk I will try it an report.
jellyzone
Gnoblar
Posts: 1
Joined: Sat Sep 08, 2012 4:04 pm

Re: Blender26 Ogre Exporter

Post by jellyzone »

hartsantler wrote:Download: (old)
. http://blender2ogre.googlecode.com/file ... -0.5.5.zip

Download Beta: requires Blender2.63 or newer
. http://blender2ogre.googlecode.com/file ... eview1.rar

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
i found a bug (maybe)

if ob.modifiers:
cleanup = True
copy = ob.copy()
#bpy.context.scene.objects.link(copy)
rem = []
for mod in copy.modifiers: # remove armature and array modifiers before collaspe
if mod.type in 'ARMATURE ARRAY'.split(): rem.append( mod )
for mod in rem: copy.modifiers.remove( mod )
## bake mesh ##
mesh = copy.to_mesh(bpy.context.scene, True, "PREVIEW") # collaspe
else:
copy = ob
mesh = ob.data

in blender documentation, it says that

Upgrading Exporters from 2.62
For exporters the most direct way to upgrade is to use tessfaces as with importing however its important to know that tessfaces may not exist for a mesh, the array will be empty as if there are no faces.

So before accessing tessface data call: bpy.types.Mesh.update (calc_tessface=True).

and
for F in mesh.tessfaces:
smooth = F.use_smooth
I found that the length of mesh.tessfaces is always 0 when you press the preview button。
if you add
ob.data.calc_tessface()
if ob.modifiers: #Original code
cleanup = True #Original code
copy = ob.copy() #Original code
#bpy.context.scene.objects.link(copy) #Original code
The preview button will act right。
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender26 Ogre Exporter

Post by Waruck »

the tessfaces are calculated in the _node_export before exporting a mesh. so as you said this is indeed skipped when exporting the preview version.
Post Reply