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
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.