Offtopic: Into Commodore 64 (6502) coding, pixeling or music?
Xentax is looking for new members for the C64 activities!
Just drop us a message at forum@xentax.com and join the Scene Team!

Forum rules: Click here

Textures of Beta Diablo 3, ".tex" files converter needed :)

Get your graphics formats figures out here! Got details for others? Post here!
MrRawr
beginner
Posts: 25
Joined: Tue Sep 13, 2011 6:37 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by MrRawr » Tue Sep 13, 2011 8:18 pm

Hmm OK. Well can anyone help with the 2D tex files which store the tga stuff?

plash
ultra-n00b
Posts: 3
Joined: Sat May 14, 2011 12:56 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by plash » Tue Sep 13, 2011 11:06 pm

..Back on topic, others and myself have been working on .tex. See here.

The pixel formats are run through a table to get the corresponding D3DFORMAT. For example, PF 4 is D3DFMT_A1R5G5B5.

Working on the pixel formats at the moment. I'll have DXT# working hopefully by the end of the day.

EDIT: Also: as with PF9 (DXT1), the components for the data are often separated.

EDIT: Someone has handled everything except for cubemaps; expect a tool soon. The spec will be updated once I am able to see the code.

npd2006
beginner
Posts: 35
Joined: Tue Sep 13, 2011 9:15 am
Been thanked: 1 time

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by npd2006 » Wed Sep 14, 2011 6:14 pm

Any idea about the textures, MrRawr ?

MrRawr
beginner
Posts: 25
Joined: Tue Sep 13, 2011 6:37 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by MrRawr » Wed Sep 14, 2011 7:07 pm

getting there, give me 30 mins...

MrRawr
beginner
Posts: 25
Joined: Tue Sep 13, 2011 6:37 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by MrRawr » Wed Sep 14, 2011 7:53 pm

Got all the data extracted but need to make them into images now. Grr.. taking longer than I want!

edit: got guests around so I have to bail. for a few hours Anyone good at converting the binaries into actual images?

BoyC
beginner
Posts: 34
Joined: Wed Jul 05, 2006 9:24 pm
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by BoyC » Wed Sep 14, 2011 9:18 pm

MrRawr wrote:Got all the data extracted but need to make them into images now. Grr.. taking longer than I want!

edit: got guests around so I have to bail. for a few hours Anyone good at converting the binaries into actual images?
Sure just slap a tga header before the data. 18 bytes:

Code: Select all

typedef struct
{
    byte  identsize;          // size of ID field that follows 18 byte header (0 usually)
    byte  colourmaptype;      // type of colour map 0=none, 1=has palette
    byte  imagetype;          // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed

    short colourmapstart;     // first colour map entry in palette
    short colourmaplength;    // number of colours in palette
    byte  colourmapbits;      // number of bits per palette entry 15,16,24,32

    short xstart;             // image x origin
    short ystart;             // image y origin
    short width;              // image width in pixels
    short height;             // image height in pixels
    byte  bits;               // image bits per pixel 8,16,24,32
    byte  descriptor;         // image descriptor bits (vh flip bits)
    
    // pixel data follows header
    
} TGA_HEADER

Necrolis
ultra-n00b
Posts: 7
Joined: Wed Sep 14, 2011 9:06 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Necrolis » Wed Sep 14, 2011 9:26 pm

enjoy (and give some feedback too!): http://diablo3dev.com/w/D3TexConv

Fiel
advanced
Posts: 46
Joined: Sun Dec 16, 2007 6:29 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Fiel » Wed Sep 14, 2011 10:32 pm

Excellent tool!

You said you needed to know which files have mipmaps and which do not based upon the value at offset 44. Here are all of the files in which offset 44 does not have a 1:

Code: Select all

Value at offset 44 - name of tex file
0x6 - arcaneTorrent_irrad.tex
0x6 - bronze_irradiance.tex
0x6 - CharacterSelect_IrradianceMap.tex
0x6 - dead_irradiance.tex
0x6 - Demon_Irradiance.tex
0x6 - ElmentalArrow_SkullIrradiance.tex
0x6 - Ghost_irrad.tex
0x6 - gold_irradiance.tex
0x6 - healthOrb_irradiance.tex
0x6 - HellIrradiance.tex
0x6 - Holy_irrad.tex
0x6 - iceShard_irradiance.tex
0x6 - irradiance.tex
0x6 - irradiance_dialogue.tex
0x6 - manaOrb_irradiance.tex
0x6 - neutral_unlit_irradiance.tex
0x6 - Selection_Hostile_Irradiance.tex
0x6 - Selection_Irradiance.tex
0x6 - silver_irradiance.tex
0x6 - trOutIrrad.tex
Output to PNG would be excellent.

EDIT:

The program crashes on these files:

2DInventoryCharms.tex
2DInventoryHammers.tex
2DInventoryMightyWeapon_2H.tex
2DInventoryPvPItem.tex
2DMapTower.tex
2DUIDebug.tex
2DUIEndScreen.tex

There are more, but that's all I'll list now.

npd2006
beginner
Posts: 35
Joined: Tue Sep 13, 2011 9:15 am
Been thanked: 1 time

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by npd2006 » Thu Sep 15, 2011 4:21 am

enjoy (and give some feedback too!): http://diablo3dev.com/w/D3TexConv
I tested it, some textures extracted successfully, but these texture, I guess it doesn't have an display icon
_01sun.tex
_2DBusy_Hourglass.tex
_2DMapCryptDungeon.tex
_2DUI_Bnet_CampaignSearching.tex
_a1dun_Cath_chest.tex
_a2dun_Zolt_Dust_Spike.tex

And the rest files, maybe the main texture which are diffuse, specular, normal maps are failed
_a1dun_caves_Boulders_A_diff.tex
_a1dun_Leoric_Dirt_01.tex
_a2Dun_Cave_Flooded_E_01_worldMask.tex
_Barb_F_Hair_diff.tex
_DH_F_CLS_HVY_norm_base_A_diff.tex
_DH_F_CLS_HVY_norm_base_A_spec.tex
_Fetish_skeleton_A_diff.tex
_Helm_DHF_nightmare_base_02a_spec.tex

Necrolis
ultra-n00b
Posts: 7
Joined: Wed Sep 14, 2011 9:06 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Necrolis » Thu Sep 15, 2011 6:34 am

Thanks for the feedback guys :D, I'll get onto fixing it now
Fiel wrote: Output to PNG would be excellent.
I'll get round to more output formats when the core is done

EDIT:
Crash on DXT1 files is solved (was me using the wrong size var -.-).
npd2006 wrote: I tested it, some textures extracted successfully, but these texture, I guess it doesn't have an display icon
they extract & view fine here, maybe your viewer is not up to scratch? (I'm using the MS DirectX Texture Viewer)

EDIT2:
Got mip mapped decoding in, gonna upload a new version now :)
made my original mip decoding code faster, but it seems D3 stores
zero sized miplevel, so the mip count is not to be fully trusted!

EDIT3: version 0.7 is live: http://diablo3dev.com/w/D3TexConv
Last edited by Necrolis on Thu Sep 15, 2011 8:36 am, edited 1 time in total.

Fiel
advanced
Posts: 46
Joined: Sun Dec 16, 2007 6:29 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Fiel » Thu Sep 15, 2011 8:13 am

Necrolis wrote:EDIT:
Crash on DXT1 files is solved (was me using the wrong size var -.-).
Thanks for the heads up. I made the change in the source code and it's working beautifully.
Necrolis wrote:they extract & view fine here, maybe your viewer is not up to scratch? (I'm using the MS DirectX Texture Viewer)
The DDS viewing works fine for me on those files. I think he needs a better DDS viewer.

Also, even after that source code change, there are still some files causing the program to crash:

arrow_poison.tex
BossWindow_middle.tex
Portal_Lightrays.tex
shoulderPads_barbF_nightmare_base_02a_TintMask.tex
shoulderPads_monkF_nightmare_base_01A_TintMask.tex
twoHandedSword_norm_unique_08_spec.tex

Necrolis
ultra-n00b
Posts: 7
Joined: Wed Sep 14, 2011 9:06 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Necrolis » Thu Sep 15, 2011 8:53 am

Fiel wrote: Also, even after that source code change, there are still some files causing the program to crash:

arrow_poison.tex
BossWindow_middle.tex
Portal_Lightrays.tex
shoulderPads_barbF_nightmare_base_02a_TintMask.tex
shoulderPads_monkF_nightmare_base_01A_TintMask.tex
twoHandedSword_norm_unique_08_spec.tex
version 0.7 no longer crashes on those files, however, some (like BossWindow_middle.tex) aren't DXTn files, so I need to add DDS header writinf for those quick

EDIT: v0.8 is out, will decode A8R8G8B8 files, just note D3 has some non-square, non-power-of-2 textures in this format (BossWindow_middle.tex), which will explode on some viewers (like MS's one)

Fiel
advanced
Posts: 46
Joined: Sun Dec 16, 2007 6:29 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Fiel » Thu Sep 15, 2011 10:08 am

Necrolis wrote:
Fiel wrote: Also, even after that source code change, there are still some files causing the program to crash:

arrow_poison.tex
BossWindow_middle.tex
Portal_Lightrays.tex
shoulderPads_barbF_nightmare_base_02a_TintMask.tex
shoulderPads_monkF_nightmare_base_01A_TintMask.tex
twoHandedSword_norm_unique_08_spec.tex
version 0.7 no longer crashes on those files, however, some (like BossWindow_middle.tex) aren't DXTn files, so I need to add DDS header writinf for those quick

EDIT: v0.8 is out, will decode A8R8G8B8 files, just note D3 has some non-square, non-power-of-2 textures in this format (BossWindow_middle.tex), which will explode on some viewers (like MS's one)
I upgraded to 0.8 and I'm still crashing on all of the same files. I really do like the improved atlases.

Necrolis
ultra-n00b
Posts: 7
Joined: Wed Sep 14, 2011 9:06 pm

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Necrolis » Thu Sep 15, 2011 10:20 am

Fiel wrote:I upgraded to 0.8 and I'm still crashing on all of the same files. I really do like the improved atlases.
odd(I know the first two files work fine now...), I'll do a more indepth look when I get back from uni later. one thing though, is the crash an assertion or just the program freezing with an access violation?

Fiel
advanced
Posts: 46
Joined: Sun Dec 16, 2007 6:29 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Fiel » Thu Sep 15, 2011 10:24 am

Necrolis wrote:odd(I know the first two files work fine now...), I'll do a more indepth look when I get back from uni later. one thing though, is the crash an assertion or just the program freezing with an access violation?
It throws two exceptions every time. First exception is a Buffer Overflow Exception, and then it's Appcrash. I'll run it through MSVC++ to see what's up.

EDIT: Ran it through the MSVC++ debugger and it exited without any exceptions. wtf...

EDIT #2: My error. The program is fine. It was a problem with the script I use that feeds d3texconv with all the files. I tried to feed it a file that didn't exist.

EDIT #3: Good news everyone! I just fed this program every single tex file and they all passed without any crashes.

Post Reply