[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3d file type



Mark D'voo wrote:

> What type of file do most people store their 3d models in.  I've been using 
> Alias's .obj file type because it is fairly easy to load, but I'm looking for 
> something a little better.  Any help appreciated.

Ah - the age-old question.

I think there are two separate questions here:

   1) What format do you produce your 3D artwork in?
      (The "MODELLER FORMAT")

   2) What format does your game read?
      (The "GAME FORMAT")

The two need not (and arguably *should* not) be the same.

Every off-the-shelf 3D format out there is lacking some sort of
vital information that my game needs.   There is also (inevitably)
a significant amount of processing that needs to be done to
massage the data that comes out of the modeller in order to make it
useful in the game.  For example, OpenGL games like triangles to be
organized into triangle strips.  You'll probably want to construct
bounding spheres around your objects...lots of stuff like that.

If you want your game to start up (and change levels) quickly, you'll
want to do as much of that processing off-line as possible.  However,
most 3D formats won't have structures that match triangle-strips, 
bounding volumes, etc.  Once you start to get into skin & bones 
animation, curved surfaces, dynamic level of detail, etc, you'll
rapidly start to feel horribly constrained by whatever off-the-shelf
format you need.

So, it's likely that you'll want to write some kind of tool that
"compiles" the 3D models that your modeller produces into a DIFFERENT
3D format for your game.

IMHO, that tool should accept a range of different input file formats
and write out files that are probably completely unique to your game
(or at least to your game *engine*).

So - that settles what the 'GAME FORMAT' is - it's something entirely
custom that's as close a fit to the in-memory layout of your models
as possible - possibly gzipped for reasons of space.

The 'MODELLER FORMAT' will probably be something like '.obj' *UNLESS*
you are lucky enough to own a modeller that supports file I/O
plugins - in which case, you would probably be well advised to write
an 'exporter' for a format that holds exactly the information you need 
as input to your 'model compiler' - and yet is easy to read and write
so as not to slow down your modelling process.

What I use for my amateur games at home is the 'AC3D' modeller - 
hence, my 'MODELLER FORMAT' is ".ac" - the native format of the
modeller, and my 'GAME FORMAT' is ".ssg" which is more or less the 
in-memory format of my PLIB game engine's 3D renderer.

At work (flight simulation - not all that unlike computer games) - we
support a very wide range of 'MODELLER FORMAT's with a model 
'compiler' that has plugins for both input and output formats.  Hence, 
the output format is once again just whatever best suits our rendering 
engine and not at all standard.

One CRUCIAL thing about this architecture is that long-term model
archive is in MODELLER FORMAT - which is good because those formats
don't change much - but the GAME FORMAT can change on an almost
daily basis (although you'll upset your artists if you change it
TOO often!)

I find that there are occasions when you'll want a THIRD file format
for communications between stages of a complex modelling tools 
pipeline.  Hence, I might want to write a 'filter' program that reads
a model in this TOOLS FORMAT and performs something like a
polygon complexity reduction and writes the file out in TOOLS FORMAT.

At the head of the tools chain, there are a number of 'readers' that 
convert various MODELLER FORMAT(s) into TOOL FORMAT - and at the tail 
of the chain
is a 'writer' that converts TOOL FORMAT into GAME FORMAT.

This allows me to re-use the tool chain from one game to another and 
to have one tool communicate special data to the next tool without 
having to 'pollute' the GAME FORMAT.
---------------------------- Steve Baker -------------------------
HomeEmail: <sjbaker1@airmail.net>    WorkEmail: <sjbaker@link.com>
HomePage : http://web2.airmail.net/sjbaker1
Projects : http://plib.sf.net    http://tuxaqfh.sf.net
            http://tuxkart.sf.net http://prettypoly.sf.net