Bug loading separate alpha texture
by Christian Rousselle · in Torque Game Builder · 07/25/2007 (3:00 am) · 6 replies
In gTexManager.cc, function loadBitmapInstance
I do not think that this works correctly. fileNameBuffer contains the extension already when files from datablocks.cs are loaded. This means that !dStricmp(extArray[i],".jpg") is always false in this case (i is always 0) . I fixed this by simply removing this statement. A better way would be to test the real file extension. Also then I have to name the alpha channel filename.jpg.alpha.jpg. I think that the person who originally developed the function expected the filenames to be passed without extension. Than this would work.
bmp = (GBitmap*)ResourceManager->loadInstance(fileNameBuffer);
// CAF: if a jpg, and RGB, look for file.alpha.jpg as alpha channel
if ( (!sgForcePalettedTexture || !dglDoesSupportPalettedTexture()) && !dStricmp(extArray[i],".jpg") && bmp && bmp->getFormat()==GBitmap::RGB)
//if ( (!sgForcePalettedTexture || !dglDoesSupportPalettedTexture()) && bmp && bmp->getFormat()==GBitmap::RGB)
{
dStrcpy(fileNameBuffer + len, ".alpha.jpg");
GBitmap * bmpAlpha = (GBitmap*)ResourceManager->loadInstance(fileNameBuffer);I do not think that this works correctly. fileNameBuffer contains the extension already when files from datablocks.cs are loaded. This means that !dStricmp(extArray[i],".jpg") is always false in this case (i is always 0) . I fixed this by simply removing this statement. A better way would be to test the real file extension. Also then I have to name the alpha channel filename.jpg.alpha.jpg. I think that the person who originally developed the function expected the filenames to be passed without extension. Than this would work.
#2
http://tdn.garagegames.com/wiki/Editing_Beginner/Tools/SuperPNG
This plugin lets photoshop export .pngs with an alpha transparency, thus preserving the correct transparent colors. Thanks very much DEDEN!
08/19/2007 (4:29 am)
DEDEN in the GG IRC channel very kindly pointed me to a solution:http://tdn.garagegames.com/wiki/Editing_Beginner/Tools/SuperPNG
This plugin lets photoshop export .pngs with an alpha transparency, thus preserving the correct transparent colors. Thanks very much DEDEN!
#3
08/19/2007 (5:26 am)
Double post
#4
08/19/2007 (11:17 am)
The problem I was referring to had nothing to do with PNG but with JPG and alpha channel as JPG.
#5
08/19/2007 (8:58 pm)
Yes, the original problem still exists. The superpng plugin is just a workaround for indie license holders as you can use it to output a .png file with the same functionality as a .jpg and .alpha.jpg combined.
#6
12/14/2007 (6:34 pm)
Still the same problem in 1.6.
Torque Owner Conor O Kane
This is extremely serious for Photoshop users. Photoshop's .png save is lossy - it deletes all color information in transparent pixels and replaces them it white, which results in a white fringe around all transparent .png images.
The only way around this in the past has been to save a .jpg with the correct background color and an alpha.jpg image. Please restore this functionality ASAP. As an indie licence holder I have no access to the source code to implement the 'workaround' listed above. I am unable to import transparent art into my game correctly until this is fixed.