Blender to Ogre Exporter

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
David27
Gnoblar
Posts: 3
Joined: Thu Feb 16, 2012 4:24 pm

Blender to Ogre Exporter

Post by David27 »

Hello,

I am new with Ogre3D. I want to do a little game. At the moment I need to export a mesh with bones and animation from Blender. I use Blender 2.6
and I tried all the existing exporter but none of them works. So I am trying to see what is the problem. For that I need the current XML Schema for the .mesh
and .skeleton format but I don't find it. Does someone know where I can find it?

Otherwise is there exporters that works with Blender 2.6?
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender to Ogre Exporter

Post by Waruck »

http://www.ogre3d.org/forums/viewtopic.php?f=8&t=61485 works pretty nice with blender 2.6

However there are a few problems with a skeleton's root bone. The position is mirrored across the y-axis and the rotation is somehow total broken. the easiest work-around for this is to add an extra root-bone which is at position (0,0,0,) and points straight upwards.
the position problem can easily be fixed after exporting by just editing the .xml file, but the rotation is a little bit more complex, since all subsequent bone's rotations are calculated relative to their parents rotation. so just add the extra bone.

if you encounter any other problems read through the thread, the chance you'll find the answer is pretty high. if not just ask for help there.
David27
Gnoblar
Posts: 3
Joined: Thu Feb 16, 2012 4:24 pm

Re: Blender to Ogre Exporter

Post by David27 »

Thank you for your answer.

But perhaps should I have first explain the real problem.

When I export my mesh. I have 4 files .mesh and .skeleton. and .mesh.xml and .skeleton.xml.

If I try with the binaries files:

If I use CEGUIMeshViewer or OgreMeshy to load the .mesh, I have this error:
OGRE EXCEPTION(7:InternalErrorException): Cannot find serializer implementation for current version [MeshSerializer_v1.41] in MeshSerializer::importMesh at ..\src\OgreMeshSerializer.cpp (line 114)

In OgreMeshy message error, it tells that I have to upgrade the files. Even if I do that with Ogre tool, it does not work. I have this error:
OGRE EXCEPTION(7:InternalErrorException): Cannot find serializer implementation for current version [Serializer_v1.10] in MeshSerializer::importMesh at ..\..\..\..\OgreMain\src\OgreMeshSerializer.cpp (line 118)

If I try with the xml files:

I think that the xml files can not been loaded in Ogre engine, the files must first be converted in .mesh and .skeleton.
So if use the 2 xml files and I convert them with the Ogre converter tool and then I load them with CEGUIMeshViewer or OgreMeshy, I have the same error:
OGRE EXCEPTION(7:InternalErrorException): Cannot find serializer implementation for current version [MeshSerializer_v1.41] in MeshSerializer::importMesh at ..\src\OgreMeshSerializer.cpp (line 114)

Here is the mesh xml file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<mesh>
    <sharedgeometry vertexcount="40">
        <vertexbuffer texture_coords="0" positions="true" colours_diffuse="False" normals="true">
            <vertex>
                <position y="-1.000000" x="1.000000" z="-1.000000"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="1.000000"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="1.000000"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000000" z="-0.999999"/>
                <normal y="1.000000" x="0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="1.000000" x="0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="1.000000"/>
                <normal y="1.000000" x="0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="0.999999" z="1.000001"/>
                <normal y="1.000000" x="0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="-1.000000"/>
                <normal y="0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000000" z="-0.999999"/>
                <normal y="0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="0.999999" z="1.000001"/>
                <normal y="0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="1.000000"/>
                <normal y="0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="1.000000"/>
                <normal y="-0.000000" x="-0.000000" z="1.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="0.999999" z="1.000001"/>
                <normal y="-0.000000" x="-0.000000" z="1.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="1.000000"/>
                <normal y="-0.000000" x="-0.000000" z="1.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="1.000000"/>
                <normal y="-0.000000" x="-0.000000" z="1.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="1.000000"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="1.000000"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-0.999999" z="-2.991193"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-0.999999" z="-2.991194"/>
                <normal y="-0.000000" x="-1.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000000" z="-0.999999"/>
                <normal y="-0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="-1.000000"/>
                <normal y="-0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="-2.991193"/>
                <normal y="-0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000001" z="-2.991193"/>
                <normal y="-0.000000" x="1.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="1.000000" x="-0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000000" z="-0.999999"/>
                <normal y="1.000000" x="-0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000001" z="-2.991193"/>
                <normal y="1.000000" x="-0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-0.999999" z="-2.991193"/>
                <normal y="1.000000" x="-0.000000" z="0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="-1.000000"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-1.000000" z="-1.000000"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-0.999999" z="-2.991194"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="-2.991193"/>
                <normal y="-1.000000" x="0.000000" z="-0.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="1.000001" z="-2.991193"/>
                <normal y="0.000000" x="0.000000" z="-1.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="1.000000" z="-2.991193"/>
                <normal y="0.000000" x="0.000000" z="-1.000000"/>
            </vertex>
            <vertex>
                <position y="-1.000000" x="-0.999999" z="-2.991194"/>
                <normal y="0.000000" x="0.000000" z="-1.000000"/>
            </vertex>
            <vertex>
                <position y="1.000000" x="-0.999999" z="-2.991193"/>
                <normal y="0.000000" x="0.000000" z="-1.000000"/>
            </vertex>
        </vertexbuffer>
    </sharedgeometry>
    <submeshes>
        <submesh usesharedvertices="true" material="_missing_material_" use32bitindexes="False">
            <faces count="20">
                <face v1="0" v2="1" v3="2"/>
                <face v1="0" v2="2" v3="3"/>
                <face v1="4" v2="5" v3="6"/>
                <face v1="4" v2="6" v3="7"/>
                <face v1="8" v2="9" v3="10"/>
                <face v1="8" v2="10" v3="11"/>
                <face v1="12" v2="13" v3="14"/>
                <face v1="12" v2="14" v3="15"/>
                <face v1="16" v2="17" v3="18"/>
                <face v1="16" v2="18" v3="19"/>
                <face v1="20" v2="21" v3="22"/>
                <face v1="20" v2="22" v3="23"/>
                <face v1="24" v2="25" v3="26"/>
                <face v1="24" v2="26" v3="27"/>
                <face v1="28" v2="29" v3="30"/>
                <face v1="28" v2="30" v3="31"/>
                <face v1="32" v2="33" v3="34"/>
                <face v1="32" v2="34" v3="35"/>
                <face v1="36" v2="37" v3="38"/>
                <face v1="36" v2="38" v3="39"/>
            </faces>
        </submesh>
    </submeshes>
    <skeletonlink name="Cube.skeleton"/>
    <boneassignments>
    </boneassignments>
</mesh>
and the skeleton xml file:

Code: Select all

<skeleton >
	<bones >
		<bone name="BoneRoot" id="0" >
			<position y="-0.000000" x="0.000000" z="0.000000" />
			<rotation angle="0.000000" >
				<axis y="0.000000" x="1.000000" z="0.000000" />
			</rotation>
		</bone>
		<bone name="Bone01" id="1" >
			<position y="1.000000" x="0.000000" z="0.000000" />
			<rotation angle="0.005349" >
				<axis y="0.002700" x="-0.000000" z="-0.999757" />
			</rotation>
		</bone>
	</bones>
	<bonehierarchy >
		<boneparent parent="BoneRoot" bone="Bone01" />
	</bonehierarchy>
	<animations >
		<animation length="0.041666666666666664" name="ArmatureAction.003" >
			<tracks >
				<track bone="BoneRoot" >
					<keyframes >
						<keyframe time="0.0" >
							<translate y="0.000000" x="0.000000" z="0.000000" />
							<rotate angle="0.000000" >
								<axis y="0.000000" x="1.000000" z="0.000000" />
							</rotate>
							<scale y="1.000000" x="1.000000" z="1.000000" />
						</keyframe>
					</keyframes>
				</track>
				<track bone="Bone01" >
					<keyframes >
						<keyframe time="0.0" >
							<translate y="0.000000" x="0.000000" z="0.000000" />
							<rotate angle="0.009161" >
								<axis y="0.000000" x="-0.000014" z="1.001009" />
							</rotate>
							<scale y="1.000000" x="1.000000" z="1.000000" />
						</keyframe>
					</keyframes>
				</track>
			</tracks>
		</animation>
	</animations>
</skeleton>
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Blender to Ogre Exporter

Post by Waruck »

maybe this is a problem with your OgreMeshy? if i copy your .xml files and convert them to .mesh and .skeleton I can open them without a problem in OgreMeshy. Can you open the Sample-meshes that come with ogre in OgreMeshy?

Also I noticed that you didn't assign the vertices to any bone... your boneassignment is just empty, so you may get a problem there...
David27
Gnoblar
Posts: 3
Joined: Thu Feb 16, 2012 4:24 pm

Re: Blender to Ogre Exporter

Post by David27 »

Ok, It works now.

I added the bone assignment and it works fine.

Thank you.