PNG with transparency in DTS shapes?
by Kirby Webber · in Torque Game Engine · 12/19/2005 (7:12 am) · 7 replies
I'm trying to create a simple, single face mesh as a "sort" of billboard in Torque (it will be stationary in the background, but won't rotate to always face the player - it will not move at all.)
I created the image (which is a city skyline) with a transparent background in Paint Shop Pro 8.0 and used the PNG export option to create the PNG file.
For those who aren't familiar, the PNG exporter will generate the alpha channel for you on export by the options you set.)
The PNG image itself is perfect, at least when I define a new guiBitmapCtrl to test it out in the GUI editore, it displays flawlessly - in game on a shape however appears to be another matter.
My shape is a simple, single face with the PNG file in question assigned as it's material... this is being exported from Milkshape 1.7.4 through the DTS Plus! exporter.
I have tried exporting with the 'transparency' flag set, I've tried 'transparency' + 'additive' as well as 'transparency' + 'subtractive' but the results are never correct.
The object, when placed in the world editor always seems to have the default MS3D material applied (yes, my custom image is applied to the object on export - I've checked 100 times, and is properly UV mapped [simple box mapping apllied in MS3D]) and seems slightly e-mapped, regardless of the 'never emap' flag being set when shown in show tool pro.
When I use additve transparency, the material is birght and semi- reflective, when I use subtractive, it's transparent black (but solid, no alpha channel) and not reflective at all.
I'm stumped. This should be so easy, but I've tried everything I know to do, including using older exporters just to be thorough.
Does anyone know if there's something I'm missing? Maybe a glitch that I'm not aware of, or preferably a workaround?
~ Thanks in advance
I created the image (which is a city skyline) with a transparent background in Paint Shop Pro 8.0 and used the PNG export option to create the PNG file.
For those who aren't familiar, the PNG exporter will generate the alpha channel for you on export by the options you set.)
The PNG image itself is perfect, at least when I define a new guiBitmapCtrl to test it out in the GUI editore, it displays flawlessly - in game on a shape however appears to be another matter.
My shape is a simple, single face with the PNG file in question assigned as it's material... this is being exported from Milkshape 1.7.4 through the DTS Plus! exporter.
I have tried exporting with the 'transparency' flag set, I've tried 'transparency' + 'additive' as well as 'transparency' + 'subtractive' but the results are never correct.
The object, when placed in the world editor always seems to have the default MS3D material applied (yes, my custom image is applied to the object on export - I've checked 100 times, and is properly UV mapped [simple box mapping apllied in MS3D]) and seems slightly e-mapped, regardless of the 'never emap' flag being set when shown in show tool pro.
When I use additve transparency, the material is birght and semi- reflective, when I use subtractive, it's transparent black (but solid, no alpha channel) and not reflective at all.
I'm stumped. This should be so easy, but I've tried everything I know to do, including using older exporters just to be thorough.
Does anyone know if there's something I'm missing? Maybe a glitch that I'm not aware of, or preferably a workaround?
~ Thanks in advance
#2
1) I'm positive the PNG has an alpha and that it is setup correctly - that's why I tested it in the gui editor to make sure the transparency would read correctly.
2) Addiditev and subtractive transparencies are primarily used for materials (as opposed to textures) to assign a transparency to the entire material, I only tried to cover all my bases.
3) I have tried shifting the transparency slider in the material editor... the effect seems to get applied to the entire material rather than reading from the alpha channel.
One thing I had thought of, but haven't tried yet is to assign a Jpeg in MS3D (instead of the actual PNG) and export using that with transparency set and switching to the PNG in the engine.
The thing is, the only reason I ever used to use jpegs and bmp's instead of the actual PNG files is that MS3D used to read them incorrectly - which appears t have been fixed in 1.7.4.
Well, it's worth a try at any rate... something has to do the trick because I know I've imported objects with alpha channel transparency before. =\
12/19/2005 (8:20 am)
Jason, I appreciate the input...1) I'm positive the PNG has an alpha and that it is setup correctly - that's why I tested it in the gui editor to make sure the transparency would read correctly.
2) Addiditev and subtractive transparencies are primarily used for materials (as opposed to textures) to assign a transparency to the entire material, I only tried to cover all my bases.
3) I have tried shifting the transparency slider in the material editor... the effect seems to get applied to the entire material rather than reading from the alpha channel.
One thing I had thought of, but haven't tried yet is to assign a Jpeg in MS3D (instead of the actual PNG) and export using that with transparency set and switching to the PNG in the engine.
The thing is, the only reason I ever used to use jpegs and bmp's instead of the actual PNG files is that MS3D used to read them incorrectly - which appears t have been fixed in 1.7.4.
Well, it's worth a try at any rate... something has to do the trick because I know I've imported objects with alpha channel transparency before. =\
#4
Let me ask you this, I am exporting this with no collision (as background scenery, it doesn't need to be collidable), could that be the issue? I wo0uldn't know why, but I've seen stranger quirks. =\
12/19/2005 (8:53 am)
Dirk: I had read that thread previously while searching out answers for the issue - good info in there, but nothing that seems to fix my issue.Let me ask you this, I am exporting this with no collision (as background scenery, it doesn't need to be collidable), could that be the issue? I wo0uldn't know why, but I've seen stranger quirks. =\
#5
You should check if the model shows the same behaviour with one of the transparent .PNG files that come with Torque, just to make sure that it is not the image. If it is not the image then triple check that you load the right model.
If this doesn't give any insight, mail me the Milkshape file plus media and I can give it a try.
12/19/2005 (12:09 pm)
No, the test I did was without collision also.You should check if the model shows the same behaviour with one of the transparent .PNG files that come with Torque, just to make sure that it is not the image. If it is not the image then triple check that you load the right model.
If this doesn't give any insight, mail me the Milkshape file plus media and I can give it a try.
#6
It'll be a bit before I can get back to "serious" dev time (the holidays tend to d that) but when I do, I'll try what you suggest - great troubleshooting advice btw. =)
If nothing pans out, I'll shoot you some files.
~ Cheers
12/19/2005 (1:28 pm)
Very generous offer. =)It'll be a bit before I can get back to "serious" dev time (the holidays tend to d that) but when I do, I'll try what you suggest - great troubleshooting advice btw. =)
If nothing pans out, I'll shoot you some files.
~ Cheers
#7
03/16/2006 (11:58 pm)
Well I just had the same problem - I found that setting No Mip Mapping in the exporter material settings did the trick.
Torque Owner Jason Farmer
Things to check though..
Png DEFINATELY has an Alpha channel, I've been caught out by this before. Made the mask then forgot to save it to the alpha channel.
Transperency flag is set in the exporter. You may want to adjust the transparency slider in the material editor.. the old exporter used this as a flag I think to switch on Transparency or not. May still be included for backwards compatability and may be overriding the transparency setting in the exporter (just a theory)
Ignore the Additive and Subtractive flags, they're basically for different effects and you don't need an Alpha channel for those to work.
Sometimes I can get this to work.. sometimes I can't. It stumps me.
Let me know if you figure it out.