.tex files from unity.bms

The Original Forum. Game archives, full of resources. How to open them? Get help here.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2649
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 652 times
Been thanked: 1360 times

Re: .tex files from unity.bms

Post by shakotay2 » Fri Oct 16, 2015 6:10 pm

you're not to clear with your posts - you wrote
When running your script, DXT5 .tex files convert successfully to dds
so DXT5 is solved, isn't it? (should not be too hard to add creating of a DXT5 header to Sigil's script - assumed what this script retrieves correct height&width from the tex files; didn't check that).

For the R8G8B8 (type 3) I used irfanview with the tga file created by barti's script like such:
R8G8B8.JPG
So for this type "only" a palette problem remains but I'm too busy to deal with such.
edit: ok, stupid me forgot to switch back to 'RGB' in 'options for 24 and 32 BPP'
but not sure whether it's a palette problem or a matter of saturation.

Guess you're on your own to transform these "results" into a working script.
(except barti will sweep in again. :wink: )
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

adabada
ultra-n00b
Posts: 7
Joined: Mon Oct 12, 2015 1:16 am
Has thanked: 4 times

Re: .tex files from unity.bms

Post by adabada » Fri Oct 16, 2015 8:31 pm

shakotay2 wrote:you're not to clear with your posts - you wrote
When running your script, DXT5 .tex files convert successfully to dds
so DXT5 is solved, isn't it? (should not be too hard to add creating of a DXT5 header to Sigil's script - assumed what this script retrieves correct height&width from the tex files; didn't check that).
My original post said I was able to use the script to convert DXT5 .tex files into dds, but had issue with DXT1 and R8G8B8. I apologise if that was not clear enough.

Yes, DXT5 is solved, DXT1 and R8G8B8 are the problem. The script does indeed get the correct height, width and type from the tex files, but because I can't find documentation on the structure of .tex files I don't know what else I need to convert DXT1 and R8G8B8 .text files to dds.

adabada
ultra-n00b
Posts: 7
Joined: Mon Oct 12, 2015 1:16 am
Has thanked: 4 times

Re: .tex files from unity.bms

Post by adabada » Fri Oct 16, 2015 11:51 pm

OK, DXT1 and DXT5 now are working. All that is left is this weird R8G8B8.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2649
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 652 times
Been thanked: 1360 times

Re: .tex files from unity.bms

Post by shakotay2 » Sat Oct 17, 2015 11:11 pm

This is a working conversion chain for R8G8B8.tex (type 3):
(image width/height: 0x0000: 2A0300002A030000 -> 810 x 810)
  • delete 56 bytes header from tex file
  • load it as raw file into irfanview and save it as tga for example
  • use TheCompressonator to convert the tga to whatever DXT format you wish
This is even quicker:
  • rename R8G8B8.tex to R8G8B8.tex.data
  • load it as "Raw image data" into gimp.
  • set the offset to 56
  • export from gimp as uncompressed dds
If you want to do this by script you need to dig into pixelformats.
With an 8x8 red pixels square (8x8x3=192=0xC0 bytes= 64x24 bits) it looks like this:
R8G8B8rawToDDS.JPG
(red.dds: uncompressed)

The hurdle may be to convert the R8G8B8.tex into a plain 24 bit file as the red.raw above. -> solved

There's a good chance to get gimp's Raw image data format specs (should be the same as for R8G8B8.tex without header).

btw: the export from gimp as uncompressed dds gives the same result as with Unity Asset Explorer - only these 15 bytes differ:
8: 0F 07
14: 7E 00
15: 09 00
1C: 01 00
20: 47 00 //G
21: 49 00 //I
22:4D 00 //M
23: 50 00 //P
24: 2D 00 //-
25: 44 00 //D
26: 44 00 //D
27: 53 00 //S
28: 01 00
29: 02 00
2A: 02 00

Then I realized that you simply have to reverse the color bytes such like this: 9C854A A38741 -> 4A859C 4187A3
so here, finally, the changed script for type 3 only. It's a mix of Sigil's and barti's codes:
For other .tex than the one we handled here check for the DDS header since mine is not reliable :cry:

Code: Select all

# Unity .tex file to .dds
#
# script for QuickBMS http://quickbms.aluigi.org

get NAME basename
string NAME += ".dds"

get WIDTH long
get HEIGHT long
get IMGSIZE long
get TYPE long
get FLAGS long
goto 0x38

if TYPE = 3

xmath PIXELS "IMGSIZE / 3"
log MEMORY_FILE 0 1

xmath PITCH "WIDTH * HEIGHT"
set DDSFLAGS long 0x8100f
set MIPMAPS long 0

if FLAGS & 0x1
    math DDSFLAGS += 0x20000
    if WIDTH > HEIGHT
        for i = WIDTH > 0
            math MIPMAPS += 1
        next i / 2
    else
        for i = HEIGHT > 0
            math MIPMAPS += 1
        next i / 2
    endif
endif

#DDS Header
put 0x20534444 long MEMORY_FILE
put 124 long MEMORY_FILE
put 0xa1007 long MEMORY_FILE
put HEIGHT long MEMORY_FILE
put WIDTH long MEMORY_FILE
put PITCH long MEMORY_FILE
put 0 long MEMORY_FILE
put MIPMAPS long MEMORY_FILE
for i = 0 < 11
    put 0 long MEMORY_FILE
next i

#Pixel format struct
put 32 long MEMORY_FILE
put 0x40 long MEMORY_FILE
put 0 long MEMORY_FILE
put 24 long MEMORY_FILE

put 16711680 long MEMORY_FILE
put 65280 long MEMORY_FILE
put 255 long MEMORY_FILE
put 0 long MEMORY_FILE

#DDS Header cont.
put 0x001000 long MEMORY_FILE
put 0 long MEMORY_FILE
put 0 long MEMORY_FILE
put 0 long MEMORY_FILE
put 0 long MEMORY_FILE

for i = 0 < PIXELS
    get C1 byte
    get C2 byte
    get C3 byte
    put C3 byte MEMORY_FILE
    put C2 byte MEMORY_FILE
    put C1 byte MEMORY_FILE
next i

get SIZE asize MEMORY_FILE
log NAME 0 SIZE MEMORY_FILE

endif
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

andeliseev
ultra-n00b
Posts: 1
Joined: Tue Dec 01, 2015 2:59 pm
Has thanked: 1 time

Re: .tex files from unity.bms

Post by andeliseev » Tue Dec 01, 2015 4:46 pm

can you help with convert this file? i think its dxt1. but it simple dont work
https://www.dropbox.com/s/eegk4xxuvfqykjs/11.data?dl=0

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2649
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 652 times
Been thanked: 1360 times

Re: .tex files from unity.bms

Post by shakotay2 » Tue Dec 01, 2015 11:21 pm

You guys - some bytes have changed and you are lost - aren't you? :)

This is type 0x24.
Cut the first 20 bytes from 11.data.
Change Sigil's script (for type 0x0C) like such for type 0x24:

Code: Select all

get WIDTH long
get HEIGHT long
get IMGSIZE long
get TYPE long
goto 0x28
get FLAGS long
goto 0x38

if TYPE = 0x24

math PIXELS = IMGSIZE
This is the result:
11-data_.jpg
btw: 20 bytes is: 4 bytes string length (DW), 15 chars string, zero byte for termination
Will be different for other strings.
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

Azurfan
advanced
Posts: 60
Joined: Wed Jun 23, 2010 10:12 pm
Has thanked: 19 times
Been thanked: 2 times

Re: .tex files from unity.bms

Post by Azurfan » Sun Dec 13, 2015 2:32 pm

I have problems with the DXT1 and DXT5 textures of Dreamfall Chapters, I got the dimensions working correctly but the rest is just a mess. The game uses Unity 5 since the last update, maybe that's part of the problem, I don't know.
http://s000.tinyupload.com/index.php?fi ... 4668502156

Can anyone here share more insight on what I should do next to get this sorted out?

User avatar
Acewell
VIP member
VIP member
Posts: 1240
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2383 times
Been thanked: 716 times

Re: .tex files from unity.bms

Post by Acewell » Sun Dec 13, 2015 3:16 pm

TextureFinder reads your tex files as just dds with a custom header.
The eye is 512x512 dxt3 and the bark is 1024x1024 dxt1, both with mipmaps and shifted by 60.

Azurfan
advanced
Posts: 60
Joined: Wed Jun 23, 2010 10:12 pm
Has thanked: 19 times
Been thanked: 2 times

Re: .tex files from unity.bms

Post by Azurfan » Mon Dec 14, 2015 9:02 pm

Thank you. :D

User avatar
blackfoxeye
veteran
Posts: 110
Joined: Tue Mar 08, 2011 12:03 pm
Has thanked: 19 times
Been thanked: 3 times

Re: .tex files from unity.bms

Post by blackfoxeye » Tue Feb 09, 2016 5:51 pm

I have a .tex file which I want to convert.
I have tried the bms scripts provided here but those scripts are unable to convert this tex file.
This is from a game, which made with Unity 5.

When I tried "TextureFinder" tool I got below image.
I have attached the tex file here.

Image

Can anybody please help, how to convert it correctly.
You do not have the required permissions to view the files attached to this post.

User avatar
Acewell
VIP member
VIP member
Posts: 1240
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2383 times
Been thanked: 716 times

Re: .tex files from unity.bms

Post by Acewell » Wed Mar 30, 2016 5:44 am

Azurfan wrote:I have problems with the DXT1 and DXT5 textures of Dreamfall Chapters, I got the dimensions working correctly but the rest is just a mess. The game uses Unity 5 since the last update, maybe that's part of the problem, I don't know.
http://s000.tinyupload.com/index.php?fi ... 4668502156

Can anyone here share more insight on what I should do next to get this sorted out?
I made a Noesis plugin that opens your sample textures for fun :D
tex_DreamfallChapters_tex.zip
You do not have the required permissions to view the files attached to this post.

User avatar
Tosyk
double-veteran
double-veteran
Posts: 936
Joined: Thu Oct 22, 2009 10:24 am
Location: Russia, Siberia
Has thanked: 226 times
Been thanked: 107 times
Contact:

Re: .tex files from unity.bms

Post by Tosyk » Thu Jul 21, 2016 7:45 pm

playing around with tex files without any results. Guys please point me in the right direction with this files:

https://dl.dropboxusercontent.com/u/991 ... .36.tex.7z
https://dl.dropboxusercontent.com/u/991 ... .36.tex.7z

thanks in advanced.
Thank you for all you do here
my blog | my forum

dragonzh
n00b
Posts: 12
Joined: Wed Jul 29, 2015 6:23 am
Been thanked: 9 times

Re: .tex files from unity.bms

Post by dragonzh » Sat Jul 23, 2016 4:32 am

Tosyk wrote:playing around with tex files without any results. Guys please point me in the right direction with this files:

https://dl.dropboxusercontent.com/u/991 ... .36.tex.7z
https://dl.dropboxusercontent.com/u/991 ... .36.tex.7z

thanks in advanced.
Try UnityEX he is on site ZoG
UnityEX ZoG
Only it is necessary to carry out the export of assets.
This is the format ktx, it is supported by console.
UnityEX export name.assets -t ktx

User avatar
Tosyk
double-veteran
double-veteran
Posts: 936
Joined: Thu Oct 22, 2009 10:24 am
Location: Russia, Siberia
Has thanked: 226 times
Been thanked: 107 times
Contact:

Re: .tex files from unity.bms

Post by Tosyk » Sat Jul 23, 2016 4:26 pm

dragonzh wrote:Try UnityEX he is on site ZoG
UnityEX ZoG
Only it is necessary to carry out the export of assets.
This is the format ktx, it is supported by console.
UnityEX export name.assets -t ktx
thanks, the tool works but I still can't open this ktx texture with PVRTexTool. I suppose they are encrypted or something. Can you take a look:
https://dl.dropboxusercontent.com/u/991 ... tex.ktx.7z
Thank you for all you do here
my blog | my forum

dragonzh
n00b
Posts: 12
Joined: Wed Jul 29, 2015 6:23 am
Been thanked: 9 times

Re: .tex files from unity.bms

Post by dragonzh » Sat Jul 23, 2016 8:56 pm

Tosyk wrote:
dragonzh wrote:Try UnityEX he is on site ZoG
UnityEX ZoG
Only it is necessary to carry out the export of assets.
This is the format ktx, it is supported by console.
UnityEX export name.assets -t ktx
thanks, the tool works but I still can't open this ktx texture with PVRTexTool. I suppose they are encrypted or something. Can you take a look:
https://dl.dropboxusercontent.com/u/991 ... tex.ktx.7z
UnityEX 1.4.0
You do not have the required permissions to view the files attached to this post.

Post Reply