[Tutorial] How to extract textures from the game.

Post Reply
User avatar
MeteoraMan
Mortal
Posts: 16
Joined: Wed Apr 22, 2015 5:14 am
Location: Russian Federation

[Tutorial] How to extract textures from the game.

Post by MeteoraMan »

1)Select a file texture from which you want to change and extract it with Gildor tools(Extractor)
I selected a file with Sub Zero texture - char_subzero_a.xxx

2)Select the texture file you want to edit from the extracted folder. The file extension must be .Texture2D
I chose this texture: char_subzero_a\Textures\SubZero_A1_Diff.Texture2D
Now we need to extract the body of the texture frome this file.
To do this we need to know the size of the header of Texture2D and the size of the texture.
NOTE: You can parse the file format and know the offset and size of the texture. But I did not analyze the format and used a stupid method.
Textures in the format of the game have the same file size as the DXT5 textures.
So just create the texture with expected size in Photoshop and save it in DDS DXT5 with mipmaps. Compare the size of the resulting file with a Texture2d file.
When you pick the right texture size, the files will be almost the same size.
screen1.jpg
In my case, the texture size was 2048*2048(All character costumes textures that I saw was 2048*2048)
Now we know the size of the texture and can calculate the size of the texture body.
Texture body size in this format or in DXT5 is Width*Height.
2048*2048=4194304
Convert this value to hexadecimal system. This can be done with a windows calculator.
4194304 -> 0x400000
Convert the height and width. it is useful to us later.
2048 -> 0x800

3)Open the Texture2d file in hex editor. I use HxD, but it could be any hex editor.
I noticed that after each texture or mip level specified its size vertically and horizontally, 4 bytes each in the reverse order(Little Endian).
Select a block from the beginning of the file, lenght is 0x400000 from the previous step.
From the end of the selection are looking for a texture size in hex system, 4 bytes each in reverse order. In my case: 00080000 00080000
Select the bytes from the end of last selection to the size of the texture and look at the size of the new selection. This is the size of the header. In this case: 0x11B
screen2.jpg
Now go to offset 0x11B
screen3.jpg
Select 0x400000 bytes from this offset and copy to new file. This is the texture body.
Open the Header file from the archive which I have attached to the message.
Header.rar
(132 Bytes) Downloaded 743 times
This header is for the 2048*2048 texture. If your texture is a different size, you need to edit the bytes marked in the screenshot for your size obtained in step 2.
screen4.jpg
Insert the header before the body of the texture and save with .DDS extension.
screen5.jpg
4)Now we need to convert the texture into an editable format.
Download the source code frome here
http://directxtex.codeplex.com/
And compile the texconv program.
Run the program with the following arguments.
texconv.exe -f R8G8B8A8_UNORM -ft DDS -px ed_ -m 1 filename.dds
Where filename is the name of the texturefile.
As a result, you get a texture named "ed_filename.dds". It can be edited in Photoshop.
NOTE: The program can convert the texture, only if your video card supports DirectX 10 or 11. I'm not exactly sure which one of them.

5)Now we can open the texture in Photoshop.
It looks weird. All we need to do is swap the red and blue channels.
Screen6.jpg
Now you can edit in Photoshop textures from the game.
How to insert them back, I will teach in the next tutorial.


User avatar
mrelectriccity
Mortal
Posts: 43
Joined: Mon Apr 20, 2015 5:57 pm
XBox Live: electricwun

Re: [Tutorial] How to extract textures from the game.

Post by mrelectriccity »

can someone please upload all the textures please or character models
ImageImageImageImageImageImage
User avatar
Gambid
Elder God
Posts: 8669
Joined: Tue Jul 08, 2003 4:17 pm
Side: Light
XBox Live: ArmoredGambid
Location: Bulgaria, Germany
Contact:

Re: [Tutorial] How to extract textures from the game.

Post by Gambid »

Great job man. Thanks for posting this here. I am going to pin it for everyone to see and use :)
I Rule This World!

Image

By the unholy darkness that consumes me, I will have the Earthrealm.

Mortal Kombat Secrets Founder and Webmaster
User avatar
a.martin
God
Posts: 1163
Joined: Sun Oct 20, 2013 4:36 pm
PSN: -
XBox Live: -
Location: Argentina

Re: [Tutorial] How to extract textures from the game.

Post by a.martin »

awesome tutorial man thanks a lot! :D I'll try to find gildor's tools and get to work on something cool :) I can't wait for the final part of the tutorial
User avatar
mrelectriccity
Mortal
Posts: 43
Joined: Mon Apr 20, 2015 5:57 pm
XBox Live: electricwun

Re: [Tutorial] How to extract textures from the game.

Post by mrelectriccity »

im lost lol im very new to this got to the hexing point but can't figure out what to do after that
ImageImageImageImageImageImage
User avatar
immortalhate
Mortal
Posts: 18
Joined: Fri Apr 24, 2015 7:40 pm

Re: [Tutorial] How to extract textures from the game.

Post by immortalhate »

thanks bro gettiing a error when trying to extract the textures with glidor?
User avatar
mrs53360
Mortal
Posts: 72
Joined: Sun May 03, 2015 4:04 am

Re: [Tutorial] How to extract textures from the game.

Post by mrs53360 »

Good job Meteora as always
MeteoraMan wrote: 4)Now we need to convert the texture into an editable format.
Download the source code frome here
http://directxtex.codeplex.com/
And compile the texconv program.
There is a compiled version for Win Texconv Tool
MeteoraMan wrote: It looks weird. All we need to do is swap the red and blue channels.
Run the program with the following arguments.
texconv.exe -f B8G8R8A8_UNORM -ft DDS -px ed_ -m 1 filename.dds
User avatar
mrs53360
Mortal
Posts: 72
Joined: Sun May 03, 2015 4:04 am

Re: [Tutorial] How to extract textures from the game.

Post by mrs53360 »

Texture2D "header"

garbage size may vary
Attachments
Untitled-1.gif
User avatar
MortalKombatXKitana
Mortal
Posts: 4
Joined: Tue May 05, 2015 12:04 am
Side: Light
PSN: corbin_2006

Re: [Tutorial] How to extract textures from the game.

Post by MortalKombatXKitana »

I don't understand how to make the HxD into a Texture.dds.. Please help!
User avatar
Llama_Renegade
Mortal
Posts: 39
Joined: Fri Apr 25, 2014 10:12 pm

Re: [Tutorial] How to extract textures from the game.

Post by Llama_Renegade »

MeteoraMan wrote: From the end of the selection are looking for a texture size in hex system, 4 bytes each in reverse order. In my case: 00080000 00080000
I don't understand this step, or how to find the 4 bytes in reverse order. Could you please explain?
User avatar
laserhawks
Mortal
Posts: 2
Joined: Thu May 21, 2020 2:09 am

Re: [Tutorial] How to extract textures from the game.

Post by laserhawks »

Super tutorial thanks man. now i have managed to extract the texture of kitana from .Texture2D file :).
here is my texture result attached is this post.

Update: Also Uploaded Normal Texture for Kitana A1 MKX

i am not able to find her hair and eye lenses. if someone knows from where to find her hairs and eye lenses. if you have one please post the texture here... thanks

Task: Find me her hair and eye lenses texture.
Attachments
Kitana.png
Kitana_A1_Norm.png
Kitana_A1_Diff.png
Last edited by laserhawks on Fri May 22, 2020 10:09 am, edited 8 times in total.
User avatar
thethiny
Immortal
Posts: 2252
Joined: Fri Jan 17, 2014 12:08 pm
Side: Light
PSN: thethiny
XBox Live: thethiny
Location: Earthrealm
Contact:

Re: [Tutorial] How to extract textures from the game.

Post by thethiny »

well done :D
Image

All of my Mortal Kombat 11 Mods are now unified under a Single Thread. Click The Image to go to the thread.
User avatar
laserhawks
Mortal
Posts: 2
Joined: Thu May 21, 2020 2:09 am

Re: [Tutorial] How to extract textures from the game.

Post by laserhawks »

thethiny wrote:well done :D
thanks bro...
Post Reply

Return to “Mortal Kombat X PC Modding Tutorials and Discussions”