VTC2 Texture Format

Textures, recreate headers, conversions, algorithms and parsing of image files
capullo-verde
Posts: 4
Joined: Wed Mar 16, 2022 9:49 pm

VTC2 Texture Format

Post by capullo-verde »

Hello.
I am trying to extract the textures of the game "Disco Elysium Director Cut" but I am unable.
It has a pluggin called "AmplifyTextureNative.dll" (or nro on Switch version. I have tried with both versions).
I decompile it with IDA Pro and hexray and it look like that textures are compressed with the codec
lzham, also have been packed using rgbcx, (that was made by the lzham codec creator) and crunch.

Sadly it It seems like the library is not directly responsible of opening vtc2 files but only process it's content (or only a part of it).

But I am unable to go on.(I have tried look on the source code of the game but i have no found anything)
I need to figure out how thoses files are opened and parsed.

Could you please help me?
I attach two textures and the decompilation.

About lzham and rgbcx I found the author github:

https://github.com/richgel999/lzham_codec


https://pypi.org/project/pylzham/

a lot of thanks
Allen
Posts: 156
Joined: Tue Sep 01, 2015 9:44 am

Re: VTC2 Texture Format

Post by Allen »

The vtc2 file is a texture container.

You can use this quickbms script to extract crn files.

Code: Select all

#Script for quickbms
#Extract crn file from vtc2 file
get numTex long
get numSplit long
xmath baseOffset " 8 + numTex * 16 + numSplit * 22"
for i = 0 < numTex
    get id long
    get offset long
    get unk long
    get size long
    math offset + baseOffset
    get NAME basename
    string NAME p "%s_%d.crn" NAME id
    log NAME offset size
next i


Then compile crunch-unity you can convert the file.
Last edited by Allen on Thu Mar 17, 2022 12:31 pm, edited 1 time in total.
spiritovod
Posts: 719
Joined: Sat Sep 28, 2019 7:00 pm

Re: VTC2 Texture Format

Post by spiritovod »

@capullo-verde: I don't think lzham and rgbcx are somehow related to this case, as the data in vtc2 files is not additionally compressed and rgbcx is just an optimized encoder to standard BC formats (which means decoding can be done through default ways).
Aside from that, those are compiled UDIM texture collection files, which contains crunch compressed tiles for virtual textures ("48 78 00" is the beginning of such blocks) and data tables, required for untiling - though it doesn't mean you can re-create all original textures from only the data, due to nature of virtual textures. Separate crn chunks can be converted with the attached tool though (they will be converted to dds by default) - note that the script above doesn't output separate chunks, but all chunks for a virtual texture, crunch will only decompress first chunk/tile from them.
You can read more about them at Amplify site and probably in the plugin code (if its source is even available):
https://amplify.pt/unity/amplify-texture-2/
https://wiki.amplify.pt/index.php?title ... e_2/Manual

I suppose the faster solution in this case would be using graphics debuggers and grabbing untiled textures at runtime or using some unity debugging tools, like UnityExplorer, for further investigation.
Last edited by spiritovod on Thu Mar 17, 2022 8:56 pm, edited 1 time in total.
capullo-verde
Posts: 4
Joined: Wed Mar 16, 2022 9:49 pm

Re: VTC2 Texture Format

Post by capullo-verde »

A lot of thanks!

Then it is as the "MegaTexture" tech which was used on Rage ,if i dont remember bad idtech 5.