Simplest file format?

A mate of mine is wirting a 3d game engine, and he asxed if i could find out for him what the simplest file format is for 3d objects.

he has the co-ordinates of the vertices, and then the co-ordinates of the mesh.

is there a similar file format i can export a simple .blend file to?

any help appreciated

thanks GFX

DXF is rather simple, and it has the added benefit of being builtin to blender…

I have the spec around here somewhere…

/me goes fishing

I’ve got a program which writes the barebones of an object to dxf, but I’m sure blender puts extra data in there too, so it’ll need a bit of parsing, but no more than any other format you could think of

OK, I found it…

the first thing to note is that the lines in a dxf file come in pairs: the first line is a number, the second line is the data. The number specifies what kind of data it is - eg the x co-ordinate of a point might be

10
134.2

the 10 meaning “x co-ordinate” and the 134.2 being the co-ordinate itself.

Writing a DXF File
This is enough information for blender to load a DXF:

0
SECTION
2
ENTITIES
<<objects>>
0
ENDSEC
0
EOF

the objects are each:

0
POLYLINE
8
<<object name>>
6
CONTINUOUS
66
1
10
<<LocX>>
20
<<LocY>>
30
<<LocZ>>
70
64
<<points>>
<<faces>>
0
SEQEND
8
<<object name>>

each vert is:

0
VERTEX
8
<<object name>>
10
<<LocX>>
20
<<LocY>>
30
<<LocZ>>
70
192

and a face is

0
VERTEX
10
0.0
20
0.0
30
0.0
70
128
71
<<first vert>>
72
<<secont vert>>
73
<<third vert>>
74
<<fourth vert>>

the fourth vertex can be omitted to have a tri face.
The vert numbers are indexes into the list of verts, the first vert is 1, the secnd is 2, etc

No that’s not a typo, the face does start with “VERTEX” - please don’t ask me why.

To read a DXF produced by blender you’d presumably read using that format, ignoring any lines that have a data type not used here - but I haven’t tried it myself.

For more info search for “DXF” on http://www.wotsit.org/

I hope this helps

If all else fails you could write your own format, and write a python export script for it

legend! :smiley: