Game Development Community

Texture packing question

by Tom Spilman · in Torque Game Builder · 06/12/2006 (2:35 am) · 8 replies

I have one point on texture packing that i'd like to get cleared up if Melv or some other TGB expert could chime in here.

I know from the docs that frames from a single image map are packed into one or more textures in order to optimize for performance. My question is if a second image map is added, will it fill any empty space in the previous texture?

More clearly are multiple image maps automatically packed into one texture if they all fit?

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.


#1
06/12/2006 (7:44 am)
This is a guess, but if you set $pref::t2d::imageMapDumpTextures = 1 I think it will save the imagemaps to disk (at shutdown) and you can look at what it did. I hope that's what it does. Would be very useful.
#2
06/12/2006 (8:04 am)
From page 16 of the image map reference, the paragraph that starts: a cautionary note.. It appears it won't pack them at least for linked image maps - or am I misunderstanding the question?
-Andrew
#3
06/12/2006 (8:08 am)
As far as I know it won't. Every image map packed in a seperate process. One image map does not have any information on the texture pages of others.

Please someone correct me if that is wrong.
#4
06/12/2006 (8:15 am)
@Andrew - I saw that one... which makes me think that...

@Michael - Your probably right... just wanted to get the definitive answer to this one.

In a future release there are probably some gains in efficiency and performance by giving the packer some hints as to which image maps would be used together in a scene. Maybe like an image category string where the user can place anything they like or nothing at all.
#5
06/12/2006 (8:33 am)
Edit: I think I misunderstood the scope of the packing. I guess it only packs within a single bitmap. That is useful, but packing across all bitmaps (with some hints, as suggested) would be much better.
#6
06/15/2006 (2:28 pm)
It's actually not that difficult to change the packing routines to pack lots of bitmaps but there are a few operational issues that involve the user having to do extra work so originally I decided not to bother.

Obviously to pack *all* bitmaps, you'd have to define/load all bitmaps at the start which is something I didn't want to enforce. To get around this you could have some kind of begin/end packing call that would logically pack-up groups of bitmaps but that would add a little extra syntax to learn but I certainly wouldn't be against that.

In-fact, the idea of begin/end pack markers could get around the issue of TGB not knowing how the textures are to be used and packing textures that are typically used in the same scene across way different textures leading to more texture thrashing. Of course we could analyse a typical run and feed that back into some kind of intelligent packing routine and this was something that Josh and I touched on way back when.

Having a begin/end pack would allow you to control the logical grouping of textures and essentially bind them as you see fit.

All suggestions are welcome.

- Melv.
#7
06/15/2006 (2:39 pm)
That seems like a great idea Melv.

My only comment is how would someone using art from a package in the resource folder, be able to customize the packing of the specific resources he uses? For that matter how could he say... don't load these image maps as i never use them? Maybe this is more of a limitation of how resource packages are done, but i thought i'd throw this out there.
#8
06/16/2006 (1:03 am)
I guess that's related to improving the art-pipeline rather than the operational characteristics of the engine but there are several ways to do this. Eventually, TGB will get more of an established art pipeline and we could then provide specific features to provide a helping hand.

- Melv.