Jump to content

Inserting textures back to .tfc - possible?


Amphibious

Recommended Posts

Drakous79, you're back! That's awesome! :smile:

 

Yes, textures use LZO-1x compression algorithm with fixed block sizes. I used minilzo library for XComLZO packer/unpacker and it works fine.

 

As far as I know, there are no uncompressed textures inside tfc. The whole purpose of texture cache is to speed up loading process and uncompressed data are too big to be used directly. Uncompressed map package takes about twice as much time to load as compressed one. Imagine how it will be with uncompressed hi-res textures. Furthermore, Gildor mentioned at his forum that all the textures inside one tfc use exact same compression method. So if we found one texture which is compressed, we can safely assume all the others are compressed either.

 

I know we should be able to shift TFC offsets and make snow maps or create additional armor decos with altered textures.

Amineri made a big progress in using Unreal Editor to create new graphics. May be we can use it to create new textures too. Edited by wghost81
Link to comment
Share on other sites

I was bad boy leaving for too long, but the time flows like crazy :) Hope you are all well!

 

You are right, uncompressed textures would eat too much resources.

 

UDK progress? Very nice! Please can you point me to the correct forum thread?

Link to comment
Share on other sites

So far my successes with UDK have been limited to packing 2DTextures for use with the GFX UI elements. In particular the Inventory images and weapon panel images (the latter requiring a Flash hex edit provided by XMTS).

 

The September 2011 UDK release matches the XCOM : Enemy Unknown release. Some of the Enemy Within packages have the engine version incremented by one, which I'm guessing is due to Firaxis customizing their engine source code a bit?

 

So far I've had no success at all with 3D models and UDK. IIRC, XMTS has used Gildor's umodel to export 3D models from the package files and import them into 3DS Max. So far the usage of that was limited to posing and capturing 2D images for creating new MEC secondary system inventory images. The issue we've had with creating package files for new 3D models is that there are required linkages with unrealscript in XComGame which we have been able to replicate via UDK.

Link to comment
Share on other sites

 

edit: just one more thing there should be uncompressed small textures inside upk files right? so if i run umodel on upk without neccessary tfc files provided this is the image that gets extracted to texture2D folder. is that right?

However when I open it with hex editor and serch for parts of the image hex code in original uncompressed upk they are nowhere to be found.

They are in DXT1 format and umodel probably converts those to something else while exporting. Furthermore, packed textures are raw data without a header and umodel adds a header with palette and other info for graphical viewer.

 

True its tga actually but I knew that different formats have different headers and footers. Some long time ago I used it to hex edit one type of file into another. but I didn't actually search for entire code just few random chunks of data from mid of the file since I presumed that's where the raw data would be that isn't affected by file type. And I got no hits to my surprise.

 

I also think I did manage to replace some flag textures some year ago with hex editing but I'm not sure. Perhaps I had to use texmod in the end (since I had dual boot system then).

 

Also I do remember some image like flags are segmented. Reference code calls only for certain bits of the original texture defined by starting text coordinated points (0,0 was upper left corner and 1,1 was bottom right if I rember well) and also widthxheight were smaller to incorporate only 1 flag. I tired squeezing in more flags and redefining those points yet for some reason it didn't work as intended since ingame textures were messed up (I got half of 2 flags on each soldier's back. I believe these positins could be edited in one of the ini files.

 

. but I don't think this is relevant for most textures since mostly starting point is 0,0 and widthxheight is that of the texture itself and not smaller.

Edited by Amphibious
Link to comment
Share on other sites

Thank you wghost.

 

So far my successes with UDK have been limited to packing 2DTextures for use with the GFX UI elements. In particular the Inventory images and weapon panel images (the latter requiring a Flash hex edit provided by XMTS).

 

The September 2011 UDK release matches the XCOM : Enemy Unknown release. Some of the Enemy Within packages have the engine version incremented by one, which I'm guessing is due to Firaxis customizing their engine source code a bit?

 

So far I've had no success at all with 3D models and UDK. IIRC, XMTS has used Gildor's umodel to export 3D models from the package files and import them into 3DS Max. So far the usage of that was limited to posing and capturing 2D images for creating new MEC secondary system inventory images. The issue we've had with creating package files for new 3D models is that there are required linkages with unrealscript in XComGame which we have been able to replicate via UDK.

 

Great job finding working UDK version! Have you set Licensee bytes to Firaxis in newly created package?

 

3D models won't be easy. You can try to change skeletal mesh in 3DS Max, import it to UDK, export to new package and then swap it from new package to some existing one.

 

Also I do remember some image like flags are segmented. Reference code calls only for certain bits of the original texture defined by starting text coordinated points (0,0 was upper left corner and 1,1 was bottom right if I rember well) and also widthxheight were smaller to incorporate only 1 flag. I tired squeezing in more flags and redefining those points yet for some reason it didn't work as intended since ingame textures were messed up (I got half of 2 flags on each soldier's back. I believe these positins could be edited in one of the ini files.

 

Flag mesh on soldier model's back has its own texture positioned by UV coordinates in DefaultContent.ini. But seen portion of the texture (visibility mask or how to call it) is set by mesh's UVW map. My best shot at understanding it resulted in switching material, so soldier's armor was covered by flags :smile:

 

Edit: Material swap. Flag's texture is all over the armor, while armor's texture is in flag's place.

 

http://i.imgur.com/2gSQYXy.jpg

 

Soldier_MaleKevlar_SF.upk, chh_lv1medmale_animset.Meshes.SM_Lv1MedMale

 

0x15aa - 4 bytes - 02 00 00 00 (how many materials; follows a list of materials)

0x15ae - 4 bytes - 70 01 00 00 (object list entry)

0x15b2 - 4 bytes - 71 01 00 00 (object list entry)

// ExtractNameLists
Index: 0x170 (368); Name: CHH_Lv1MedMale_MOD.Materials.MInst_Flags; Type: Core::Engine.MaterialInstanceConstant
Index: 0x171 (369); Name: CHH_Lv1MedMale_MOD.Materials.MInst_Lv1MedMale1; Type: Core::Engine.MaterialInstanceConstant

Swap 70 with 71.

Edited by Drakous79
Link to comment
Share on other sites

 

Great job finding working UDK version! Have you set Licensee bytes to Firaxis in newly created package?

The new packages work fine without having to make any hex changes at all. That is, the Licensee bytes were unchanged but the resultant upk works fine.
It's also possible to use any older version of UDK (for a while I was using June 2010 version UDK). For 2DTexture images at least, it works just fine. Eventually I was able to zero on on the September 2011 version as almost perfectly matching the XCOM release. I haven't had any success with importing package files back into UDK, though -- it throws up errors about missing classes in XComGame.

 

They are in DXT1 format and umodel probably converts those to something else while exporting. Furthermore, packed textures are raw data without a header and umodel adds a header with palette and other info for graphical viewer.

The textures for 3D models and some of the 2D UI textures (like the strategy layer flags) are in DXT1 format, but the inventory and weapon panel images are in DXT5 format, since it has better support for alpha channels (I'd guess).

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...