Game Development Community

Power of two image. Incorrect packaging.

by Dmitriy Stukalov · in Torque Game Builder · 10/26/2007 (5:53 am) · 7 replies

Hello,

There is power of 2 image in my project (128x64 pixels).
www.invitinggames.com/friends/GarageGames/001/source_image.pngI'm going to explain how my textures will packed with TGB by the code bellow
$pref::T2D::imageMapDumpTextures = 1;
$pref::T2D::imageMapShowPacking = 1;
I will surprised with a result I've found in the "imageMapDump" directory.
www.invitinggames.com/friends/GarageGames/001/imagemap_dump.pngThe image has been resized to 128x256 pixels!!!
I use a CELL image mode with a 64x64 cell size.
What's wrong?

Thank you.

EDIT: Incorrect URL

#1
10/26/2007 (1:00 pm)
I discovered (a little too late for not being bothered by redoing a lot of imagemap) that doing exact power of two is NOT a good idea, you must make images with a lesser size if possible, because padding automatically add 2 or 3 pixel to the imagemap.
#2
10/26/2007 (9:26 pm)
Thats why sometimes its recommended to NOT use padding... i dont use it if my images sizes are exact powers of two... if they're not, then i dont mind.
#3
10/26/2007 (9:34 pm)
As far as I am aware (I've not looked at the code, but I remember this from a conversation), the reason for the extra couple of pixels is to make sure that the texture is ready for mip-mapping (which can be an issue if you have color pixels on the very edge of your image), so it goes ahead and trades image "safety/accuracy" for size.

As Ehrlichmann mentions, just turn off padding for that image and you should be fine.
#4
10/26/2007 (11:52 pm)
Thank you guys!

I've turned off padding for all my CELL images and now ImageMap dumps are OK.

Thank you!
#5
10/27/2007 (11:33 am)
But if you turn it off you'll have glitches on the border of the image map, most of the time.
#6
10/28/2007 (12:47 am)
Unless the artist properly plans for the mipmapping process, meaning that they don't draw on the very edges of the image.
#7
10/28/2007 (10:41 pm)
Quote:
But if you turn it off you'll have glitches on the border of the image map, most of the time.
Thank you for your mention Benjamen. I remember this issue pretty well. As you can see there is a free space between painting area and image edges.