Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: aldo_14 on June 09, 2004, 04:36:30 pm

Title: Opacity support
Post by: aldo_14 on June 09, 2004, 04:36:30 pm
Can we use partially transparent (i.e. translucent) maps with the SCP?

(may be a stupid question, I've been out of the loop as to what gets added in the SCP)
Title: Opacity support
Post by: WMCoolmon on June 09, 2004, 05:32:25 pm
Isn't that what the alpha component of TGA textures is for?
Title: Opacity support
Post by: aldo_14 on June 09, 2004, 06:08:21 pm
Quote
Originally posted by WMCoolmon
Isn't that what the alpha component of TGA textures is for?


Er.... I don't know.
Title: Opacity support
Post by: WMCoolmon on June 09, 2004, 06:15:34 pm
Hmm, well I really have no clue how to use it...here's what the wiki has to say:

Quote
TGA

This format creates fairly large file sizes but the key thing about this format is that it allows an alpha channel. An alpha channel lets you specify transparency as if it was another colour layer, just like red, green or blue, this allows 'shades' of transparency unlike the old system. The PCX image system of transparency uses pure green as a mask, a pixel is either fully transparent or not. With the system this flag activities the colour pure green has no significance and is processed like any other colour.

So what does this mean? Well when saving a TGA do not save as 32 bit unless you have an alpha channel set up. Otherwise the engine will assume there is an alpha channel but the lack of one will cause the entire texture, although loaded properly to display as fully transparent, i.e. invisible. A 32-bit TGA is just a 24-bit TGA with space for an alpha channel. Saving as 16 or 24 bit will not throw up this problem but for those formats you will not be able to use an alpha channel.

Now that you know about the alpha channel I'm going to tell you not to use it. At least not in the 3D engine, i.e. ship and effect textures. The FS2 engine has many limitations and rendering transparent textures correctly in 3D is one of them. Fixing this (or implementing it in any engine) is not trivial and is likely never to be attempted. If you choose to ignore this then you will probably find that the result of using it is different on various systems and that something that looks like its working in a simple in game scene will fall apart in larger situations.

Use of alpha channel transparency should be restricted to the same images that used pure green PCX masking, for interface graphics. This feature has many possibilities, many of which have not been trying in practical situations; I'm guessing that there may still be some bugs or limitations (depending how you wish to see it) to come to light.
Title: Opacity support
Post by: aldo_14 on June 09, 2004, 06:22:47 pm
Ah.  Baws.

Guess I'll have to fudge it then.
Title: Opacity support
Post by: Lightspeed on June 09, 2004, 06:31:25 pm
Although it says you shouldnt use it, it seems to works fine.

Semi-Transparent stuff IS possible.
Title: Opacity support
Post by: Liberator on June 09, 2004, 08:38:27 pm
I was fixin' to say, didn't they fix that when they implemented the alternate texture formats?
Title: Opacity support
Post by: Bobboau on June 09, 2004, 08:57:06 pm
despite that, what you want to use it for may allow it to work acceptably, for cockpits it should be good enough, though someowhat tricky to get working right, the thing is you can only realy controle render order on a single model, don't do anything that is going to have a texture blend from one ship to another, try to keep it from one part of a model to another, haveing the transparent textures as either part of the main hull or as a lower numbered subobject. this should work
Title: Opacity support
Post by: Nico on June 10, 2004, 01:54:15 am
Yes/No. basically, what Bob said, excepted that FS2 will not render the parts of the ship behind it. Before, you could do by making the transparent part a separate subobject, but it seems that won't work anymore...  So I doubt you'll be please with the result.
Title: Opacity support
Post by: Bobboau on June 10, 2004, 02:00:14 am
hey, you know,
you never sent me that cob/pof to see if I could get it working corectly...
:D
Title: Opacity support
Post by: Raptor on June 10, 2004, 05:57:45 am
This may not be what your looking for but...

When using PCX maps, pure green (0, 255, 0) is transparent in game.  Combine with shine/glow maps to put a slight sheen to the transparent areas, that might get what your after.  Maybe.
Title: Opacity support
Post by: Deepblue on June 10, 2004, 04:38:55 pm
You mean shine/environment maps. :D
Title: Opacity support
Post by: aldo_14 on June 10, 2004, 04:40:04 pm
Quote
Originally posted by Raptor
This may not be what your looking for but...

When using PCX maps, pure green (0, 255, 0) is transparent in game.  Combine with shine/glow maps to put a slight sheen to the transparent areas, that might get what your after.  Maybe.


Pure green screws up the occlusion, though.  Doesn;t really matter - I'm not going to be doing modelling unless I can figure out a solution to my smoothing problem (that doesn't involve using TS)
Title: Opacity support
Post by: Nico on June 11, 2004, 02:36:12 am
Quote
Originally posted by Bobboau
hey, you know,
you never sent me that cob/pof to see if I could get it working corectly...
:D


True that, completly forgot :p
But actually, just reskin a turret of, say, the orion with a transparent map and you'll have the same result :)