3D Max exporter exports with offset

Hey there!

I’m new to this forum and i am working for about half a year on my own little hobby project using Panda3D. I create all my work in 3D Studio Max, so i am quite happy about the stable exporter now (Panda version 1.5.4), great work there, thanks a lot!

I still would like to mention a little issue that i had with it which gave me quite some headache: When i export an object, the pivot point of the object seems to be ignored. Instead the objects offset in world space is added to the vertex position. Here is a little example:

Say I have a cube (relative vertex coordinates from -10,-10,-10 to 10,10,10) and it’s location is xyz 100,0,0. The exported object’s location is 0,0,0 and it receives vertex coordinates from 90,-10,-10 to 110,10,10.

This is rather troublesome if you want to create more complex scenes with more objects, which you might want to control via python (i use 3D Studio Max as a modeller and as a level editor and feel quite comfortable with that). Taking the example of above, if i would spin my cube in max, it would rotate around its center. Exporting and rotating the cube in panda would make the cube spin around the world’s center!

I can work around that by moving every object (via a script) to the worlds center before exporting, but this is a little cumbersome if you export often (which my experience tells me will happen). Is it possible for a future version to have a tickbox added with something like “export with local coordinates”?

I would give it a try myself, but i am rather a graphic artist with some minor scripting skills than a “real” programmer (alltough i was thinking of building a maxscript EGG exporter… maybe next year). And i think it is fair to assume that this wouldn’t present a huge change in code…?

Thanx in advance

PS: i made a small check if that issue was already mentioned on the forum, but couldn’t find any. If it is, then just ignore my post.

Unfortunately, despite the recent fixes in 1.5.4, the Max exporter is still largely unmaintained, since no one claims ownership of it. I’d love it if some Max user who’s also a programmer would be willing to step up to fix bugs or support feature requests like this.

But there may be a solution outside of the Max exporter. In the egg syntax in general, what you are asking for is a flag. DCS stands for Dynamic Coordinate System, and means you intend to animate the coordinate system of the so-tagged object. If you hand-edit your egg file to add the line:

<DCS> { 1 }

within the that defines your cube, this should tell Panda that it is important to preserve the transform on the cube so that you can modify it in-game (without the flag, Panda will prefer to optimize it away, for a small performance gain).

That presumes that the Max exporter is, in fact, properly writing the transform to the egg file in the first place. If it is not, then the DCS flag won’t help you.

It’s possible that there’s also already a feature within the Max exporter to insert the DCS flag (or, equivalently, { dcs }). I don’t know enough about the Max exporter to say whether this is true or not.


Thanx for the fast reply!

Unfortunately the exporter does not write an objects transform :frowning: . It pretty much just exports the vertex positions, -uv’s and -normals. So no DCS hack for me then.

Guess i’ll take the stony way and write a little exporter myself then. Lets see if i have time for that.

Are you sure ?
I haven’t tried 1.5.4 max2egg, but the old 1.5.3 DOES.
Anyway, it could be the behavior of the .egg loader, which creates a ModelRoot for you.

Here is an .egg sample of a simple plane :

<CoordinateSystem> { Z-Up }

<Group> "Scene Root" {
  <Group> Plane01 {
    <Transform> {
      <Matrix4> {
        1 0 0 0
        0 1 0 0
        0 0 1 0
        3.07074 6.48221 0 1
    <VertexPool> Plane01.verts {
      <Vertex> 0 {
        1.35737 8.08286 0
        <Normal> { 0 0 1 }
      <Vertex> 1 {
        1.35737 4.88155 0
        <Normal> { 0 0 1 }
      <Vertex> 2 {
        4.78412 8.08286 0
        <Normal> { 0 0 1 }
      <Vertex> 3 {
        4.78412 4.88155 0
        <Normal> { 0 0 1 }
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <VertexRef> { 0 1 2 <Ref> { Plane01.verts } }
    <Polygon> {
      <RGBA> { 1 1 1 1 }
      <VertexRef> { 3 2 1 <Ref> { Plane01.verts } }

Here is its hierarchy once loaded :

ModelRoot myPlane.egg
  PandaNode Scene Root
    GeomNode Plane01 (1 geoms) T:m(pos 3.07074 6.48221 0)

As you can see, the result of .egg loader is a ModelRoot node, not directly Plane01, eventhough I only exported Plane01 mesh.
So, instead of operating on the ModelRoot, you should find the plane :

def loadObject(path,name):
    # scene.ls()
    return modelroot.find(name)

plane = loadObject('myPlane','**/Plane01')

Hmmm… do you mean there is a dedicated “max2egg.exe” (like “maya2egg.exe”) somewhere? Because i couldn’t find any in the BIN dir of panda and a quick search through the forums just revealed that other people were asking for that.

The exporter which i use is the 2009er plugin for 3DSMax (“maxegg2009.dlo”), version 1.5.4. This is what i get when i export a simple plane:

<CoordinateSystem> { Z-Up }

<Group> character {
  <Dart> { 1 }
  <Group> Plane01 {
    <VertexPool> Plane01.verts {
      <Vertex> 0 {
        -35.4072 -19.3583 0
        <Normal> { 0 0 1 }

I also tried to export only the object instead of the whole scene, beside the addition of the Scene Root group there isn’t any change. The transform-entry just doesn’t show up on my version.

If there is an alternative to this plugin, i would be VERY glad, as it can’t be scripted and i want to automate as much as possible. I’m working alone on the project and the easier i can create stuff, the more content i can do on my own and the easier it would be for me to keep up the motivation… :smiley:

I started to create my own exporter based on maxScript now and are running in some difficulties with the format (particularily UV coordinates). If anybody has a useful thread about the EGG file format at hand (beside of the official documentation on SF), i would appreciate it a lot! I’ll check what the forum search has got for now.

Actually, there are many alternative ways to export stuff from 3dsmax to Panda3D.

One is to acquire the Panda (no, not related to Panda3D) .X exporter. This is a pretty good alternative actually since it supports bones and animation and Panda3D can import the file even without a cmd conversion with x2egg.exe.

Another that came to mind was exporting as .obj. This way you lose bones etc. but the basic geometry with UV coordinates and whatnot is still there. You can convert this .obj into .egg IIRC and most other applications can import it if you want to try converting it that way.

In the future, collada will also become an option if you want to consider your pipeline stuff in the long run :wink:

Yea, i have seen this, i just didn’t think this would be a good solution, as i might loose more data going through a third file format.

My game is about hovering robots (very convinient: no exported animations, bones or whatsoever :smiley: ). The main focus of my toolchain lies on a sorta 1:1 conversion of the 3D Max materials (as far as Panda supports it), as i want the robots to have various materials with different shininess, specularity maps, glowing maps, reflection maps, normal maps, etc… and i don’t want to be bothered hacking that stuff into my code or the EGG files.

From my experience these kinds of information is lost easily by exporters. I know the Panda X-exporter does quite a good job. Guess i’ll give it that a try. My pessimistic view towards exporters still makes me expect i might need to write my own exporter… :unamused: /me cursing my stupid perfectionism…