Register    Login    Search   View active topics    FAQ




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Tutorial] How to extract textures from the game.
 Post Posted: Tue Apr 28, 2015 5:26 am 
Offline
Mortal
User avatar

Joined: Wed Apr 22, 2015 5:14 am
Posts: 16
Location: Russian Federation
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.
Attachment:
screen1.jpg
screen1.jpg [ 209.29 KiB | Viewed 12103 times ]

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
Attachment:
screen2.jpg
screen2.jpg [ 3.57 MiB | Viewed 12103 times ]

Now go to offset 0x11B
Attachment:
screen3.jpg
screen3.jpg [ 70.16 KiB | Viewed 12103 times ]

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.
Attachment:
Header.rar [132 Bytes]
Downloaded 447 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.
Attachment:
screen4.jpg
screen4.jpg [ 266.21 KiB | Viewed 12103 times ]

Insert the header before the body of the texture and save with .DDS extension.
Attachment:
screen5.jpg
screen5.jpg [ 731.35 KiB | Viewed 12103 times ]


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.
Attachment:
Screen6.jpg
Screen6.jpg [ 686.34 KiB | Viewed 12103 times ]

Now you can edit in Photoshop textures from the game.
How to insert them back, I will teach in the next tutorial.


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Tue Apr 28, 2015 11:58 am 
Offline
Mortal
User avatar

Joined: Mon Apr 20, 2015 5:57 pm
Posts: 43
XBox Live: electricwun
can someone please upload all the textures please or character models

_________________
ImageImageImageImageImageImage


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Tue Apr 28, 2015 12:13 pm 
Online
Elder God
User avatar

Joined: Tue Jul 08, 2003 4:17 pm
Posts: 8032
Location: Bulgaria, Germany
Side: Light
XBox Live: Armored 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


Top 
 Profile  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Tue Apr 28, 2015 1:24 pm 
Offline
God
User avatar

Joined: Sun Oct 20, 2013 4:36 pm
Posts: 1151
Location: Argentina
Skype: -
PSN: -
XBox Live: -
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


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Tue Apr 28, 2015 1:31 pm 
Offline
Mortal
User avatar

Joined: Mon Apr 20, 2015 5:57 pm
Posts: 43
XBox Live: electricwun
im lost lol im very new to this got to the hexing point but can't figure out what to do after that

_________________
ImageImageImageImageImageImage


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Wed Apr 29, 2015 12:00 am 
Offline
Mortal
User avatar

Joined: Fri Apr 24, 2015 7:40 pm
Posts: 10
thanks bro gettiing a error when trying to extract the textures with glidor?


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Sun May 03, 2015 4:13 am 
Offline
Mortal
User avatar

Joined: Sun May 03, 2015 4:04 am
Posts: 72
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


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Sun May 03, 2015 5:30 pm 
Offline
Mortal
User avatar

Joined: Sun May 03, 2015 4:04 am
Posts: 72
Texture2D "header"

garbage size may vary


Attachments:
Untitled-1.gif
Untitled-1.gif [ 51.1 KiB | Viewed 11871 times ]
Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Tue May 05, 2015 12:08 am 
Offline
Mortal
User avatar

Joined: Tue May 05, 2015 12:04 am
Posts: 4
Side: Light
PSN: corbin_2006
I don't understand how to make the HxD into a Texture.dds.. Please help!


Top 
 Profile E-mail  
 
 Post subject: Re: [Tutorial] How to extract textures from the game.
 Post Posted: Tue May 12, 2015 4:33 pm 
Offline
Mortal
User avatar

Joined: Fri Apr 25, 2014 10:12 pm
Posts: 39
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?


Top 
 Profile E-mail  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

 Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

  Design by Mighty Gorgon