Sign in to follow this  
dannyman179

How does the game handle transparency?

Recommended Posts

I've noticed while extracting a good number of textures from the KOTOR 1 game files that the ones that are mostly black have no alpha on them(such as the ones with stars). Does the game have a special way of handling textures that makes them transparent with this or is this an issue with all of the tpc to tga converters for the game? If anybody has an explanation of this that would be great, i cant seem to find a way to easily and quickly remove the black from the images.

Share this post


Link to post
Share on other sites

It depends. Generally, transparency is handled through the alpha channel. Depending on things it may also need a TXI file or it may not even need an alpha channel. Which textures are you looking at? Also, what are you using to convert them?

Share this post


Link to post
Share on other sites

I am using the xoreostex2tga tool. How do I use the .txi file to give the image transparency? I understand that the game may handle model transparency in its own way, I'm just trying to figure out how that is.

Share this post


Link to post
Share on other sites

For the TXI file, you need a bit of code depending on what you want, something like:

 

blending punchthrough

or

 

blending additive

 

But that depends on having a properly working alpha channel. It's just telling the game how to blend what's already there. Some textures may be lacking all this if the blending is handled in another manner - for example, some windows might be a solid texture with the transparency simply applied on the mesh, and some visual effect textures don't need anything either because it's already handled through the particle system. But the vast majority should have a standard alpha channel. I'd suggest converting the same textures with KOTOR Tool to make sure it isn't your tool that's converting them wrong.

  • Like 1

Share this post


Link to post
Share on other sites

I've used the KotOR tool and gotten the same results. A lot of objects that should be transparent just aren't. ill have to do some checking into what you mentioned. I don't need the KotOR game itself to handle the transparency though, I'm attempting to put the files into a separate game engine - so I'm just trying to get the transparency to work in other places.

Share this post


Link to post
Share on other sites

The game handles transparency in a lot of ways, as JCarter426 touched on.

 

Most often the alpha channel in a texture isn't used for transparency, it is used as a sort of 'strength map', either for an environment cubemap or a normal map. More transparent = stronger effect.

 

There's an alpha controller for any mesh subtype node for specific models. This is used, but somewhat rarely.

 

Textures can have 'blending punchthrough' in their TXI info, which causes the alpha channel in the texture to be interpreted as transparency and properly take other geometry behind the transparent area into account when compositing.

 

Models have a 'transparencyhint' in the mesh subtype node header, this acts as a 'blending punchthrough' for specific nodes, and keeps you from having to specify 'blending punchthrough' in TXI information. (It doesn't let you use the alpha channel for other purposes on the same texture though).

 

Textures can have 'blending additive' in their TXI info, which makes them behave like a 'screen' or 'overlay' blending mode in photoshop, wherein black essentially becomes 100% transparent and white becomes 100% opaque. This might not use information from an alpha channel at all (mostly it is used in textures that don't have alpha channels in the vanilla assets), but I don't know what happens when you do have alpha channel info and are using 'blend additive'.

 

TPC files have an alpha blending (possibly alpha mean) value in their header, which relates to compositing behavior (you probably wouldn't need to worry about that in unity).

 

In your original quesion about stars/black backgrounds, just guessing, you are probably looking at a 'blending additive' situation.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this