The Evil Within 2 *.bimage

Textures, recreate headers, conversions, algorithms and parsing of image files
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

The Evil Within 2 *.bimage

Post by Delutto »

The bimage file format has some changes from previous game, I already figured out some things(not sure):

Code: Select all

Int32 - Some XOR verification ?!?
Int32 - Magic = BIM\08
Int32 - Unknown = Allways 0 ?!?
Int32 - Width
Int32 - Height
Int32 - Unknown
Int32 - Unknown = (Possible PixelFormat info)
Int32 - MipMap Count

MipMaps starts in offset 0x2A
Int64 - Index ?!?
Int32 - Width (Or Height ?!?)
Int32 - Height (Or Width ?!?)
Int32 - DataSize

Here some samples and a fail DDS:
TEW2.7z
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: The Evil Within 2 *.bimage

Post by episoder »

Why "fail dds"? It's a correct file. It contains a red channel and an alpha channel bitmap. Now... you wanna puzzle the rest or have the solution?

The width and height is correct. The format enum is at 0x1D. 0x13 is dxt5. 0x15 is ati2. 0x17 is bc7, which you may only be able to output with the dx10 extension header. I'm not sure if there ever was a compatible FourCC for regular dds.

If i had to guess the rest, I'd say fmt 0x14 is ati1, 0x16 is bc6h.

Screw me. Let me attach my script style. Basicly the same. I just write the dds header on the fly. Note that it outputs everything using the dx10 header. Noesis is able to open all of those tho. Edit: Wth. Let me just add a noesis plugin too. :mrgreen:
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: The Evil Within 2 *.bimage

Post by Delutto »

episoder wrote:Why "fail dds"? It's a correct file. It contains a red channel and an alpha channel bitmap.
Thank you. I'm just start to learn about DDS, but my main problem was the crap Gimp DDS plugin which does not load the transparency as alpha channel and show me this:
Image
That's why I was thinking that my DDS was wrong. I'm working with Photoshop now...

episoder wrote:If i had to guess the rest, I'd say fmt 0x14 is ati1, 0x16 is bc6h.
I'm testing on all games files to check this. Thank you again.
Leveraging your expertise, can you tell me what is the function of the dwDepth, when and how should set it?
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: The Evil Within 2 *.bimage

Post by episoder »

Delutto wrote:... problem was the crap Gimp DDS plugin which does not load the transparency as alpha channel and show me this:
...
That's why I was thinking that my DDS was wrong.

Weird. It should open this correct. It's just dxt5. Limp doesn't even open bc6 and bc7 tho. No point in trying to use that.

Delutto wrote:... Leveraging your expertise, can you tell me what is the function of the dwDepth, when and how should set it?

What is dwDepth? It's not in my script. Logically it should be the depth (number of slices) for volume textures, nothing else.
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: The Evil Within 2 *.bimage

Post by Delutto »

episoder wrote:What is dwDepth? It's not in my script. Logically it should be the depth (number of slices) for volume textures, nothing else.
I was talking about DDS especification, not about the script. I'm using MS docs to learn about DDS: https://msdn.microsoft.com/en-us/library/windows/desktop/bb943982(v=vs.85).aspx and trying understand how properly set all information, since some of the converted DDS are broken, even using your script, but I need to do more tests.
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: The Evil Within 2 *.bimage

Post by episoder »

Delutto wrote:
episoder wrote:What is dwDepth? It's not in my script. Logically it should be the depth (number of slices) for volume textures, nothing else.
I was talking about DDS especification, not about the script. I'm using MS docs to learn about DDS: https://msdn.microsoft.com/en-us/library/windows/desktop/bb943982(v=vs.85).aspx and trying understand how properly set all information, since some of the converted DDS are broken, even using your script, but I need to do more tests.


I can take a look at the data if you want. Could be other formats. Or cubemaps perhaps. They're finicky to extract.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: The Evil Within 2 *.bimage

Post by Acewell »

original research thread here, why delutto create a new :)
viewtopic.php?f=7&t=5090
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: The Evil Within 2 *.bimage

Post by Delutto »

Acewell wrote:original research thread here, why delutto create a new :)
viewtopic.php?f=7&t=5090
Ooops... well, I couldn't find any stuff about the game using the Forum Search, so I created this one... sorry...
Anyway, your Noesis script isn't enough, I need more information to make my tool compatible with all textures formats used in game.
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: The Evil Within 2 *.bimage

Post by episoder »

Delutto wrote:... I need more information to make my tool compatible with all textures formats used in game.


What more information you need? I mean i could pin the fmt byte from those 4 files. Upload more samples and we can try to read what the errors are. I think there's not alot more then adding more if fmt and decode lines in the script. :)
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: The Evil Within 2 *.bimage

Post by Acewell »

Delutto wrote:Anyway, your Noesis script isn't enough, I need more information to make my tool compatible with all textures formats used in game.
i know my script was incomplete, there was a lack of diverse samples uploaded, all i needed was more samples. :)

Delutto wrote:I couldn't find any stuff about the game using the Forum Search
a search for "bimage" works well though :D
Delutto
Posts: 561
Joined: Tue Oct 13, 2015 1:26 pm

Re: The Evil Within 2 *.bimage

Post by Delutto »

episoder wrote:What more information you need? I mean i could pin the fmt byte from those 4 files. Upload more samples and we can try to read what the errors are. I think there's not alot more then adding more if fmt and decode lines in the script. :)
I already found the other ones:
0x0B = DXT5
0x12 = DXT1
0x13 = DXT5
0x14 = ATI1 (Your guess was right)
0x15 = ATI2
0x16 = BC6H (I set DXGI to DXGI_FORMAT_BC6H_TYPELESS) There's a need to set something different in this format like flags or something else?
0x17 = BC7

I only save as DX10 the BC6H and BC7.

My export algo save the MipMaps too, but here's my question: For import, reading the DDS file, how I'll known the data size, width and height of each MipMap?

Acewell wrote:
Delutto wrote:I couldn't find any stuff about the game using the Forum Search
a search for "bimage" works well though :D
Yeah... the forum search fool me... :cry: