.egg vs .x (Is there any need to convert?)

Hi,

I’m working on a little open source project. And I’d like all of my models to be freely available to the public.

As such, I’m planning to leave them in .x format, so that anybody can use them in any modeling package they please (free or otherwise).

But I’m just a bit worried that using .x format models in Panda may not be as good or efficient as using Panda’s proprietary .egg format. Does anybody know if there is a difference? Is it better to use one instead of the other in Panda? Or doesn’t it matter?

Thanks a lot.

If I’m correct the best efficiency can be reached by using bam files.
Panda can load .x, .egg and .bam files for rendering

x can be converted to egg
egg can be converted to bam

x and egg are textfiles, bam is a binary format so Panda can load the bam file a bit quicker than others.
So if you want to have a quick startup of your game use bam, else you can use x or egg.

Thanks Martin.

Do you know if the .bam format supports animations? Or is it just for static models?

Cheers

I think bam supports animations but I’m not sure if never tried it.
I’m currently working with Linux without an installed Panda so im not able to try it sorry
Martin

bam supports everything egg supports, so yes, it supports animations.

Although bams are the best way to load a file in-game, because they load so quickly, it’s also a good idea to keep the .x files around for two reasons: one, so that the models may be more easily loaded in other packages (as you have observed), and two, because the bam file is tied to a particular version of Panda, and if you later download a version of Panda that no longer supports the version of the bam file(s) you have generated, you will need to regenerate them from the .x files.

David

Ah Ha! Thanks a lot David.

I think that’s what I’ll do, I’ll create two versions of each model, one in .x format and the other in .bam.

I just need a little clarification first, because I haven’t done this before (I’ve been saving my models in .egg format directly from 3ds Max).

If I use the following code on my goblin model:

import direct.directbase.DirectStart
from pandac.PandaModules import *

# Load the model
goblin = loader.loadModel("MONSTERS/GOBLIN/goblin")

# Convert the model to Bam format
goblin.writeBamFile("goblin.bam")

Will it work the same way as exporting a model from 3ds Max? In other words, will it save the new goblin.bam model in the MONSTERS/GOBLIN folder?

So that when I open my GOBLIN folder I’ll see goblin.bam listed as one of the available models?

Also, will all the texture and animation data be saved with the new Bam model?

Thanks a lot.

Actually, if you are using 3DSMax, I’d recommend continuing to write your models out in the .egg format, rather than using .x as an intermediate format, since the MaxEgg converter is likely to do a better job. In general, the fewer conversion steps your models go through, the better off you are. (Panda doesn’t actually load .x files natively; it internally converts them to .egg.) But you can try using .x and see what you think of it.

But you should still make bam files. The best way to make a bam file is with the program egg2bam, as shown in the manual. You can also write a bam file in Python code, and it should do more-or-less the same thing, although this way might not do as good a job in storing the texture paths (it might end up storing the full pathname to the texture, for instance, which wouldn’t work if you then distributed the bam file to someone else’s machine). It’s worth a try, though.

David

Thanks David, I’ll give that a try.

Cheers

We have a group here that’s using caching. They ship their models as egg files, but when you launch the game the first time, it generates bam files.

Hm… that would be interesting functionality to incorporate into panda, make it automatic.