Sign in to follow this  
Rictus

KotOR Why do some models reject .txi files?

Recommended Posts

Hi all, I am currently trying to add a cubemap to JC's Cloaked Jedi Robes for K1 and have run into an issue.

I am trying to give the boots a leathery appearance and have followed the following steps:

Add transparency to the boots in the PMBIC01.tga

Created PMBIC01.txi using "envmaptexture CM_Baremetal" without quotations. (Just in case I also tried PMBI01.txi later in case I misunderstood how sub variants of textures connected to .txi's)

Placed them in the override, loaded a game and found transparency instead of reflection.

I then changed the appropriate appearance.2da entry from DEFAULT to cm_baremetal and it worked properly. (Just for the record it was for P_MAL_C_MED_04)

I then tried reverting the .2da to DEFAULT, removed the .tga and .txi from my override, and converted them into a .tpc (just in case a .tpc was read differently), but was left with transparency again.

Which brings me to my question "Why do some models reject .txi files?" 

Obvioulsy the model/texture works or changing the .2da wouldn't have had any effect. All of the armor variants that use cubemaps work while the envmap entry in appearence.2da is set to DEFAULT. And the partenvmap in baseitems.2da, and the Palette ID in the .uti files, are both set to 1 for both robes and armor which is the only other potentially relevant settings I can find.

So, is there any way to make the this model/texture use the desired cubemap without making a universal change via .2da? Or is it a hardcoded issue with certain objects?

Share this post


Link to post
Share on other sites

Texture sets defined by appearance.2da will only use the TXI data from the 01 texture. So if the 01 texture doesn't have the semantic you want then editing the 02, 03, 04, etc. texture TXIs won't do anything. It's presumably due to the way the engine instances data to handle memory use on the Xbox.

TL:DR: Add whatever semantic you want to the 01 texture's TXI as well.

Share this post


Link to post
Share on other sites

I could be misunderstanding but that seems to be a separate issue.

The only way I was able to get the cubemap to apply was by editing the .2da, I was using the 01 texture variant and it worked that way. I haven't tried adding 02 onward.

But without editing the .2da the cubemap isn't applied even using the 01 tariant.

Other models such as the armors, apply a cubemap from a .txi when the envmap column in the .2da is set to DEFAULT. The robe models in the same row do not.

All of the player models PMBA-J share a single envmap setting in appearance.2da. If I change the .2a to cm_baremetal won't that override any alternate cubemap information? (Such as cm_glow for powered armor.)

Share this post


Link to post
Share on other sites
On 12/15/2024 at 3:42 AM, Rictus said:

Add transparency to the boots in the PMBIC01.tga

You need to use the alpha layer, not add actual transparency. Only 32-bit Targa images can have an alpha layer.

This is a bit much, but the alpha layer could look something like this:

afbeelding.png.c95d83e4be446c33a69cb82e5f329602.png

Tip: I take the normal image, desaturate it and then invert the colors, if needed tweak the white/black balance.

Result:

afbeelding.png.f7134578bc26bffa9e8d133a44e5eae3.png

P.s. PMBIC01 is the gloveless Caucasian skin version, PMBI01 is the version with gloves. Which gets used depends on which option you picked when installing the mod.

Share this post


Link to post
Share on other sites

Interesting. Was your .2da set to envmap set to default for this? And were you using the PMBI column for the model?

I use gimp for my image editing and all the images I import have an alpha layer already, so even if I just move the opacity slider down it works. At least as far as the transparency effect.

Spoiler

20241217144541_1.jpg.76e7ffbc78359298dca6110f5e429223.jpg

This is at 75% opacity. I actually converted the .tga to .tpc just to double check the .txi was being imported properly (I used tga2tpc and it read the associated .txi. The exact text contained was "envmaptexture CM_Baremetal" without quotations)

That image was just to demonstrate, I would usually add a layer mask to apply the alpha with desired the effect just like you described.

Spoiler

20241217151928_1.jpg.118c14fe824985394a7b1693c1be886c.jpg

The same skin with the appearence.2da envmap column edited to cm_baremetal.

I have only had a little experience in image editing, so maybe I am misunderstanding the difference between my process and what I should be doing.

My other thought was that when KotOR loads it doesn't check the internal .txi information for certain assets, but uses a default. e.g. t checks PMBH for .txi info but not PMBI. But if your second image was from an unmodified .2da for the exact same model and texture that's obviously not the case.

Edit: I actually tried this out. I renamed JC's PMBIM .mdl and .mdx to PMBHM and put on some armor

Spoiler

20241217155259_1.jpg.3b5a701295cb0a6f95399c18fdb4e92d.jpg

Note the original armor texture is used but has transparency not the cubemap effect. So it is ?definitely? an issue with the model or how my system deals with rendering the model, not a texture or .txi issue. 

Anyway, I am perfectly happy for my Jedi to wear brown suede shoes, I was just curious about the how and why this issue occurs.

Edited by Rictus

Share this post


Link to post
Share on other sites
13 hours ago, Rictus said:

Interesting. Was your .2da set to envmap set to default for this? And were you using the PMBI column for the model?

Yes, JC's mod doesn't change those values. So, without the .txi file the envmap = DEFAULT. There aren't that many uses for actual transparent parts in a texture.
 

13 hours ago, Rictus said:

I use gimp for my image editing and all the images I import have an alpha layer already, so even if I just move the opacity slider down it works. At least as far as the transparency effect.

I think you are confusing transparency with the use of the alpha layer. Open the attached file in GIMP and you'll see that there's no transparency/transparent parts in the main layer, but there is an alpha layer (the largely white image I added yesterday). Because of the CM_Baremetal the alpha layer controls in which parts that texture "shines through" (black = fully, white = not at all).
I don't have GIMP but in Photoshop the channels panel looks like this:

afbeelding.png.d216af6b4f286ba8db2076bc53d67a29.png

In that tab you can click the alpha layer to show/select it and then edit it.

13 hours ago, Rictus said:

Note the original armor texture is used but has transparency not the cubemap effect. So it is ?definitely? an issue with the model or how my system deals with rendering the model, not a texture or .txi issue. 

Anyway, I am perfectly happy for my Jedi to wear brown suede shoes, I was just curious about the how and why this issue occurs.

Uhh, (apart from this texture not working with the model) I think you would now need a PMBIM.txi, if you want the alpha layer to make certain parts metallic like the normal armor does.
A tpc file has that texture information (txi) inside of it, but if there's a .tga file without a txi file then that DEFAULT from the envmap column gets used.

I'm sure it's not your system, I hope studying the attached tga helps you understand, don't give up ;)

PMBIC01.tga PMBIC01.txi

Share this post


Link to post
Share on other sites

Never mind I am just an idiot.

Quote

Texture sets defined by appearance.2da will only use the TXI data from the 01 texture. So if the 01 texture doesn't have the semantic you want then editing the 02, 03, 04, etc. texture TXIs won't do anything. It's presumably due to the way the engine instances data to handle memory use on the Xbox.

@DarthParametric Was right all along. Only it applies to racial/alphabetical variants not just numerical. I assumed PMBIC was a totally different thing to PMBI with it's own 02 etc variants, because it has a letter before the numbers. So long as I have a PMBI01 texture and .txi, pmbic01 and presumably all others also gain the alpha effect, even if PMBI01 isn't using its alpha layer.

Quote

I could be misunderstanding but that seems to be a separate issue.

You were definitely misunderstanding past me. Never doubt a Dark Lord!

So, looking at other textures, since PFBE01-7 all use cm_baremetal but PFBE08 uses cm_bright, then the cubemap used in the 01 texture is still overridden by the .txi of any other file. the game just needs to check if any alpha is applied when reading the 01 file? Weird. Or I am wrong. Again. I wouldn't be surprised.😅

Edited by Rictus

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