shape up the x. file?

OK, before we begin, I must warn that I have only begun exploring the universe of scripting, let alone panda.
I have greated a model in milkshape, exported as an .x file as recomended in other tutorials etc…
However, when I inserted the filename (replacing the exsisting actor file name)…nothing apeared in my grey veiwing box.

Is there someone out there that can enlighten me on how exactly to insert .x files into panda?

To my understanding, panda would convert them automatically in a scene???

Thanx for all your help in advance.

If you didn’t get an error message then it should have worked. Probably the camera just isn’t looking at the model.

You should reposition either the model or the camera and then point the camera at the model.

Yep, there are a dozen things that could have gone wrong. Especially if you are new to Panda3D. Probably just a tiny problem, but in order to help you we need more information, e.g.

  • have there been errors, if yes: please post tracebacks
  • the part of your code where you load the model
  • the directory structure (where is the .x file)
  • if nothing helps: the .x file itself


The easiest way to know if it’s the model that is bad or your code that is bad is to use pview.exe on the model

If pview is able to load your model then there is 99,9% of chance that the model is good and your code is not OK.

If you see nothing in pview but you have no error msg in the console,
press the “C” key to center the cam on the model.

In the last part of the manual there is detailed instruction on how to use pview.

wow, jhanx heaps everyone, I thought it could have been a simple thing, but wasnt sure…will look into it

I have had trouble loading .x models as well. These .x models work fine when put through xtoegg, but trying to load them directly as .x causes no errors (node.analyze() responds with correct vertices etc.) but no model appears. Is this a bug?

Maybe your normals are flipped incorrectly (setTwoSided(True))
Or, maybe the camera is placed inside the model? zoom out a bit perhaps.

It did not work at any zoom level, far out and far in… As a side note, I lost the masking on my textures going from .x to .egg, is ther an easy way to get it back?

You mean the transparency?
You can enable it by setting setTransparency(1) on the model. In pview, there should be also some shortcut for it. Try t or o or something similar.

no, setting transparency does not work. What I mean is a masked color on the texture that is see through. Say, all pixels of 1,.5,.5 are transparent.

Is there a way to do this, or am I blowing smoke?

Um. You want all pixels that are painted one particular color in your texture to be transparent? I guess you could write a shader to do that. But there’s no way to do it using the standard fixed-function pipeline.

It would be easiest to edit the texture in a program like Gimp or Photoshop and put an alpha channel on. Then set the alpha channel to 0 wherever you want it to be transparent.