XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Tue Sep 25, 2018 2:08 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: .tex files from unity.bms
PostPosted: Fri Oct 16, 2015 6:10 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2382
Location: Nexus, searching for Jim Kirk
Has thanked: 562 times
Have thanks: 1241 times
you're not to clear with your posts - you wrote
Quote:
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:

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: )


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
Bigchillghost, Reverse Engineering a Game Model: http://forum.xentax.com/viewtopic.php?f=29&t=17889
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Fri Oct 16, 2015 8:31 pm 
Offline
ultra-n00b

Joined: Mon Oct 12, 2015 1:16 am
Posts: 7
Has thanked: 4 times
Have thanks: 0 time
shakotay2 wrote:
you're not to clear with your posts - you wrote
Quote:
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.


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Fri Oct 16, 2015 11:51 pm 
Offline
ultra-n00b

Joined: Mon Oct 12, 2015 1:16 am
Posts: 7
Has thanked: 4 times
Have thanks: 0 time
OK, DXT1 and DXT5 now are working. All that is left is this weird R8G8B8.


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Sat Oct 17, 2015 11:11 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2382
Location: Nexus, searching for Jim Kirk
Has thanked: 562 times
Have thanks: 1241 times
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:
(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:
# 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


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
Bigchillghost, Reverse Engineering a Game Model: http://forum.xentax.com/viewtopic.php?f=29&t=17889
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Tue Dec 01, 2015 4:46 pm 
Offline
ultra-n00b

Joined: Tue Dec 01, 2015 2:59 pm
Posts: 1
Has thanked: 1 time
Have thanks: 0 time
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


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Tue Dec 01, 2015 11:21 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2382
Location: Nexus, searching for Jim Kirk
Has thanked: 562 times
Have thanks: 1241 times
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:
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:


btw: 20 bytes is: 4 bytes string length (DW), 15 chars string, zero byte for termination
Will be different for other strings.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
Bigchillghost, Reverse Engineering a Game Model: http://forum.xentax.com/viewtopic.php?f=29&t=17889
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Sun Dec 13, 2015 2:32 pm 
Offline
advanced

Joined: Wed Jun 23, 2010 10:12 pm
Posts: 60
Has thanked: 18 times
Have thanks: 2 times
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?


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Sun Dec 13, 2015 3:16 pm 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1105
Has thanked: 2201 times
Have thanks: 623 times
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.

_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Mon Dec 14, 2015 9:02 pm 
Offline
advanced

Joined: Wed Jun 23, 2010 10:12 pm
Posts: 60
Has thanked: 18 times
Have thanks: 2 times
Thank you. :D


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Tue Feb 09, 2016 5:51 pm 
Offline
veteran
User avatar

Joined: Tue Mar 08, 2011 12:03 pm
Posts: 110
Has thanked: 19 times
Have thanks: 3 times
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.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Wed Mar 30, 2016 5:44 am 
Offline
VIP member
VIP member
User avatar

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1105
Has thanked: 2201 times
Have thanks: 623 times
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


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
Noesis
Hex2obj
QuickBMS
Asset Studio
TextureFinder


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Thu Jul 21, 2016 7:45 pm 
Offline
double-veteran
double-veteran
User avatar

Joined: Thu Oct 22, 2009 10:24 am
Posts: 925
Location: Russia, Siberia
Has thanked: 219 times
Have thanks: 104 times
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


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Sat Jul 23, 2016 4:32 am 
Offline
n00b

Joined: Wed Jul 29, 2015 6:23 am
Posts: 12
Has thanked: 0 time
Have thanks: 9 times
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


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Sat Jul 23, 2016 4:26 pm 
Offline
double-veteran
double-veteran
User avatar

Joined: Thu Oct 22, 2009 10:24 am
Posts: 925
Location: Russia, Siberia
Has thanked: 219 times
Have thanks: 104 times
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


Top
 Profile  
 
 Post subject: Re: .tex files from unity.bms
PostPosted: Sat Jul 23, 2016 8:56 pm 
Offline
n00b

Joined: Wed Jul 29, 2015 6:23 am
Posts: 12
Has thanked: 0 time
Have thanks: 9 times
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


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


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