Jump to content
  • Advertisement
Sign in to follow this  
Mawww

suggestions for a 3D model format ?

This topic is 4848 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well I recently (2 month ago) thrown my old & crappy 3D engine (i had began it 4 years ago, and the design was too "simplistic") and started a new one, using advanced coding technics (I mean multiple inheritance, templates, interfaced systems)... anyway, now it is time for me to design the 3D models format it will use, here is the basic overview :
header (magic word, version, perhaps model name...)

number of vertexes
vertexes [number of vertexes]
normals  [number of vertexes]
texcoords[number of vertexes]
bones    [number of vertexes*4]
bones weight [number of vertexes*4]

number of materials
materials[number of materials] (contain texture name, shader name, and colors values)

number of meshs
meshs[number of meshs] (contain faces indexes, material ID for the mesh)

number of bones
bones[number of bones] (contain informations on bones and on their animation)

number of animation sequences
animations[number of animation sequences] (contain information on animation start/end)
well, do you have any suggestion on the format, things that are bad or good in the design, any advices ?

Share this post


Link to post
Share on other sites
Advertisement
I find it more fun to design it myself, and I have not seen any 3D model format that are optimized for my engine.

and as I use opengl (well the only renderer i coded at the moment is the opengl one) I'm not really keen on .x files, and i prefer binary file formats.

Share this post


Link to post
Share on other sites
I just serialize my classes. They kind of make their own format. This way, I don't feel compelled to document exactly how it's layed out. I've discovered drawbacks to this, but it is the way several commercial 3D engines I know of work (e.g., Unreal, Gamebryo, etc.).

Share this post


Link to post
Share on other sites
triangles strips will be made by the exporter... but as I discovered that nowdays, using VBOs, triangles are faster than triangles strips (at least for terrain rendering), I'm not sure if I will use them.

serializing does not seems like a good solution to me, writting an exporter un python for blender will be harder without a well defined format (I choosed blender just to show that i wont be able to use my c++ code)

Share this post


Link to post
Share on other sites
I use the MD2 format.......But that shouldn't matter to you.

I recommend you make a list of your exact needs for the format.
ie. Animation(Keyframe, or skeletal), binary(not text-format), normals, whatever you have to have.

Then make a list of what you would like but don't need.
ie. Normals(MD2 doesn't include them, I calculate them upon load)

Then get a good list of common formats and compare their feature set with yours, and pick the closest match. As in, the one that has everything you need and the least of the other stuff you don't. if nothing matches your needs, then and only then make your own format.

Share this post


Link to post
Share on other sites
I use XML (seriously) for every file format I use, besides image files. I only need to manage a single file loader (i.e. the XML loader, which I just use TinyXML for anyway) and then read all the data into my app. No need to worry about changing the order of variables in a structure, data sizes, etc.

As for structuring the XML doc, how about something like:


<xml header crap>
<model>
<header vertexcount="3034" trianglecount="449" bonecount="49" />
<vertices>
<vertex position="3.5 3.5 4.6" normal="1.0 0.0 0.0" texcoord="1.0 0.0" />
...
repeat for all vertices
</vertices>
<triangles>
<triangle vertex1="4" vertex2="5" vertex3="59" />
...
repeat for all triangles
</triangles>
<bones>
<bone name="root" parent="NULL" weightcount="30">
<weight vertex="49" strength="0.5" />
...
repeat for all weights
</bone>
...
repeat for all bones
</bones>
</model>

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!