Page 1 of 1

irr mesh/scene exporter for max, wip, need help

Posted: Thu Feb 19, 2009 2:07 am
by poulpi33
hello,

I'm currently writing a full scene exporter plugin for max for irrlicht.
I need help for the mesh export (irrmesh format)

Here an export of a simple box with smoothings groups:

Code: Select all

<?xml version="1.0"?>
<mesh version="1.0">
	<boundingBox minEdge="-25.0 -25.0 -25.0 " maxEdge="25.0  25.0  25.0 " />
	<buffer>
		<boundingBox minEdge="-25.0 -25.0 -25.0 " maxEdge="25.0  25.0  25.0 " />
		<material>
			<enum name="Type" value="solid" />
			<color name="Ambient" value="ffffffff" />
			<color name="Diffuse" value="ffcccccc" />
			<color name="Emissive" value="ff5d5d5d" />
			<color name="Specular" value="ff000000" />
			<float name="Shininess" value="0.0" />
			<bool name="Wireframe" value="false" />
			<bool name="GouraudShading" value="true" />
			<bool name="Lighting" value="true" />
			<bool name="ZWriteEnable" value="true" />
			<int name="ZBuffer" value="1" />
			<bool name="BackfaceCulling" value="true" />
			<bool name="FogEnable" value="false" />
			<bool name="NormalizeNormals" value="false" />
			...
			<texture name="Texture4" value="" />
			<bool name="BilinearFilter4" value="false" />
			<bool name="TrilinearFilter4" value="false" />
			<bool name="AnisotropicFilter4" value="false" />
			<enum name="TextureWrap4" value="texture_clamp_repeat" />
			<float name="Param1" value="0.000000" />
			<float name="Param2" value="0.000000" />
		</material>
		<vertices type="standard" vertexCount="24">
			-25.000000 -25.000000 -25.000000 -1.000000 0.000000 0.000000 ffffffff 1.000000 0.000000
			25.000000 -25.000000 -25.000000 1.000000 0.000000 0.000000 ffffffff 0.000000 0.000000
			-25.000000 -25.000000 25.000000 -1.000000 0.000000 0.000000 ffffffff 0.000000 0.000000
			25.000000 -25.000000 25.000000 0.000000 0.000000 1.000000 ffffffff 0.000000 0.000000
			-25.000000 25.000000 -25.000000 -1.000000 0.000000 0.000000 ffffffff 1.000000 1.000000
			25.000000 25.000000 -25.000000 1.000000 0.000000 0.000000 ffffffff 0.000000 1.000000
			-25.000000 25.000000 25.000000 -1.000000 0.000000 0.000000 ffffffff 0.000000 1.000000
			25.000000 25.000000 25.000000 0.000000 0.000000 1.000000 ffffffff 0.000000 1.000000
			-25.000000 -25.000000 -25.000000 0.000000 -1.000000 0.000000 ffffffff 1.000000 0.000000
			25.000000 -25.000000 -25.000000 0.000000 -1.000000 0.000000 ffffffff 0.000000 0.000000
			-25.000000 -25.000000 25.000000 0.000000 -1.000000 0.000000 ffffffff 1.000000 1.000000
			25.000000 -25.000000 25.000000 0.000000 -1.000000 0.000000 ffffffff 0.000000 1.000000
			-25.000000 25.000000 -25.000000 0.000000 1.000000 0.000000 ffffffff 0.000000 0.000000
			25.000000 25.000000 -25.000000 0.000000 1.000000 0.000000 ffffffff 1.000000 0.000000
			-25.000000 25.000000 25.000000 0.000000 1.000000 0.000000 ffffffff 0.000000 1.000000
			25.000000 25.000000 25.000000 0.000000 1.000000 0.000000 ffffffff 1.000000 1.000000
			-25.000000 -25.000000 -25.000000 0.000000 0.000000 -1.000000 ffffffff 0.000000 0.000000
			25.000000 -25.000000 -25.000000 0.000000 0.000000 -1.000000 ffffffff 1.000000 0.000000
			-25.000000 25.000000 -25.000000 0.000000 0.000000 -1.000000 ffffffff 0.000000 1.000000
			25.000000 25.000000 -25.000000 0.000000 0.000000 -1.000000 ffffffff 1.000000 1.000000
			25.000000 -25.000000 25.000000 1.000000 0.000000 0.000000 ffffffff 1.000000 0.000000
			25.000000 25.000000 25.000000 1.000000 0.000000 0.000000 ffffffff 1.000000 1.000000
			-25.000000 -25.000000 25.000000 0.000000 0.000000 1.000000 ffffffff 1.000000 0.000000
			-25.000000 25.000000 25.000000 0.000000 0.000000 1.000000 ffffffff 1.000000 1.000000
		</vertices>
		<indices indexCount="36">
			9 11 12 12 10 9 13 14 16 16 15 13 17 18 20 20 19 17 2 21 22 22 6 2 
			4 23 24 24 8 4 3 1 5 5 7 3 
		</indices>
	</buffer>
</mesh>
But when i open it in irredit, the mesh is broken. Vertices are in place, but it seems that indices are in the wrong order because some triangle goes from one angle to the opposite. And i don't understant what in the order of my indices is wrong, since if i draw it "by hand" following this code, there is no triangle that cross the box. (well actually i did not check all of them, but half :wink: )

Posted: Thu Feb 19, 2009 9:07 am
by hybrid
Indices start with 0

Posted: Thu Feb 19, 2009 9:10 am
by Pyritie
Ooo, this would be nice. Are you planning to add animation support?

Posted: Thu Feb 19, 2009 12:52 pm
by zillion42
cool... :D can you write one for maya aswell ? <-just joking

Posted: Thu Feb 19, 2009 1:12 pm
by poulpi33
hybrid wrote:Indices start with 0
:oops:

Thanks !
3ds max start arrays and loops at 1 and not 0. I will decrement all indices by 1 and it should work then.

For animation i have to search the api doc and sdk to find how irrlicht load them. But afaik irrmesh does not have a type (like tangents, 2tcoords...) for bones weights for skinning.

I'm not working with maya, only max so it will be only for max.

Posted: Thu Feb 19, 2009 1:23 pm
by JP
People have said before that the .irrmesh format is rather.... bad... due to the fact that it's XML. That makes its file size larger and also slower to load...

I'm just pointing that out so that people consider whether they're bothered about the filesize and load times. I'm not sure how much worse they are though of course.

Posted: Thu Feb 19, 2009 1:51 pm
by poulpi33
JP wrote:People have said before that the .irrmesh format is rather.... bad... due to the fact that it's XML. That makes its file size larger and also slower to load...

I'm just pointing that out so that people consider whether they're bothered about the filesize and load times. I'm not sure how much worse they are though of course.
Yes but it's easier to start with and debug, then when it will work i will output to irrbmesh (binary format of the irrmesh).

Posted: Thu Feb 19, 2009 2:00 pm
by JP
Ahh I didn't realise there was an irrbmesh... sounds like your plan is a good one then :)