egg2bam TXO generation size difference in 1.8.1

Hi,
I was generating TXOs with Panda 1.7.2 and for 2048x2048 textures the txo size is about 2.7MB. Then I change to Panda 1.8.1 and now for the same texture the txo size is about 5.5MB.

The parameters im using are: “egg2bam -txo -ctex …” and i also adding minfilter { linear_mipmap_linear } in the egg file.

I need to change something in this version of Panda to get the same file size i get in 1.7.1?

Thanks.

Hm? I don’t understand how you can end up with a txo that small for a 2048x2048 texture.

If your texture is RGB, then you have 2048x2048x3 bytes, or about 12MB. Even if it’s only grayscale, you still have 2048x2048x1 bytes, or about 4MB; but then you add mipmapping, which adds another 33%, making it about 5.3 MB. And since txo files are uncompressed, the file size is pretty much the same as the number of bytes needed for the texture (plus a few extra for the file format overhead).

The only thing you can change to make a smaller file is to start with a smaller texture.

David

Hi David, thanks for your answer.
I don’t know why, maybe something wrong in the process. I can tell you what i’m doing:

  • I have a color texture in tga format, 2048x2048 pixels.
  • I generate an egg file like this:
<Texture> info {
	"mytexture.tga" <Scalar> minfilter { linear_mipmap_linear }
}
<Group> {
	<VertexPool> vpool {
	<Vertex> 0 {
	-0.5 0.5 0
	<UV> { 0 1 }
	}
	<Vertex> 1 {
	-0.5 -0.5 0
	<UV> { 0 0 }
	}
	<Vertex> 2 {
	0.5 -0.5 0
	<UV> { 1 0 }
	}
	<Vertex> 3 {
	0.5 0.5 0
	<UV> { 1 1 }
	}
	}
	<Group> info {
	<Polygon> {
		<RGBA> { 1 1 1 1 }
		<TRef> { info }
		<VertexRef> { 0 1 2 3 <Ref> { vpool } }
	}
	}
}
  • Then i run: egg2bam -txo -ctex eggtxotemp.egg -o eggtxotemp.bam
  • After the process i get this:
    – 1 bam file (i don’t need it)
    – 1 txo file: In Panda 1.7.2 the size is about 2.7MB. In Panda 1.8.1 about 5.5MB.

In bouth cases the txo in the engine looks good.
I don’t know the txo format, but i never got a 12MB file in my tests.
Tell me if I can bring more information to clarify the case.

and thanks again.

Ah, I didn’t notice the -ctex in your command line earlier. This enables texture compression, so your textures are successfully being compressed by one scheme or another. It sounds like in Panda3D version 1.7.2, it selected the compression DXT1, and in version 1.8.0 it selected compression DXT3.

You can Google these compression schemes to learn more about them, but the bottom line is that DXT1 is twice as small as DXT3 but really sacrifices the quality of the alpha channel (you only end up with 1 bit of alpha). If you don’t care much about the alpha channel (or you don’t even have an alpha channel), then DXT1 is the better choice.

Panda must be deciding that your image has an alpha channel that you care about. If you don’t need the alpha channel, remove it from the tga file. If you do want the alpha channel but don’t care about the compression artifacts of DXT1, you can tell Panda that you only care about keeping 1 bit of the alpha channel by adding the line:

<Texture> info {
   "mytexture.tga" <Scalar> minfilter { linear_mipmap_linear }
  <Scalar> format { rgbm }
}

This will allow Panda to choose DXT1 to compress your texture.

David

Done. If i use a 24 bits tga the size of the txo is 2.7MB, i don’t need alpha in this case, so that’s perfect.
Thanks David!