Similarity between EGG formats

I was looking through the EGG file formats of 3DSMax, Maya and Blender since I needed it to read the triangles and vertices.

I realized that the EGG files seem to look different for each exporter.

For example:
In Max, there seem to be triangles in ‘VertexRef’.
In Maya, representation is in quads.
In Blender I don’t really understand the format as some look like 3 vertices and some 4 in ‘VertexRef’. (for blender I was looking at the ‘chicken’ exported EGG file)

  1. Does someone know what the format is for Blender?

  2. Is there a way to convert them all into the same format…or it would require extra code to parse it. (Is that the way Panda handles reads it, with specific code to parse the EGG files based on the Modeling software) ?

Actually, they all conform to the .egg format and are all valid .egg. They just might use different ways to achieve the same thing. I think the Maya and Max exporters use Panda’s egg library to write the .egg files, while chicken writes it manually.

They are all loaded by Panda’s egg library (via the EggData class), there’s no modeling-tool-specific code in there.

If you want to read out triangles and vertices from an existing model (loaded via the egg loader or so), you can use the GeomVertexReader - this is documented in the manual.
If you really need to read it from the egg file, however, you can use the EggData class to retrieve it.

Note that the egg format doesn’t specify the number of vertices that should be in each polygon–it will happily accept triangles, quads, pentagons, hexagons, triskadecagons, whatever you give it.

If all that’s hanging you up is the wish to read triangles only, you can convert an egg file to triangles only with the command:

egg-trans -C -o out.egg in.egg

This subdivides all of the higher-order polygons in in.egg, and writes the result to out.egg, which now contains only triangles.

David

Thanks. Will try these methods out.

you can also use Egg api directly, see some of my scripts here:
discourse.panda3d.org/viewtopic … 3614#23614

Works great for what I need for now.

I will look into the other methods so that this extra step is avoided if time permits.

Thanks.