This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [TOOL]  A new BLP Converter  (Read 11711 times)

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
[TOOL]  A new BLP Converter
« on: August 17, 2013, 11:33:58 pm »
Hi all -

I had been previously been trying to rely on some combination of two versions of BLPConverter and BLPLab to convert every blp in the MPQ tree to a png for use in non blizz things.  Unfortunately while they are pretty good there are still certain file types and methods that these tools fail on, making it pretty much impossible to have a toolchain where an engine doesn't complain that stuff is missing.   I'm sure if you have been hardcore into anything with BLPs you'll know how most of the 4-bit alpha textures do not work with the converters available, for example.

Anyway, I got pretty fed up yesterday and wrote a BLP Converter.. it seems to handle all the texture types correctly with my testing so far..  I'd like to release a version of it to the community as a very simple CLI tool.. blah.exe infile outfile, maybe with some options.  Currently I have it writing out to my own .TXR format with mipmaps included.

If you were to have a tool like this, what are the primary outputs you'd want, say besides PNG?  Is that good enough?  What about the other mipmaps beyond the base level?  What about other features?

FYI I'm only testing it with WOTLK data, except for Interface data which is whatever's the latest on bnet.  It seems to work with the newer uncompressed A8R8G8B8 types as well so it might work for all MoP stuff, not sure.   If someone wants to try let me know.  I"d like to find out what bugs might exist as currently I'm just going around the world seeing if anything looks off.  One thing that might need testing is clothing type textures...

Curious about going in the other direction as well (? to BLP).. what do you all use for that and is it okay for your purposes? The above tools seem to work okay for that but I don't do that much.

Would be glad to share the code as well if anyone is interested, PM me.. it's very very small/short/easy.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #1 on: August 19, 2013, 12:35:14 pm »
Alright, here is the code.. it's part of my general converter app now but I will put it in its own executable soon and link it here soon.

In the meantime..

.cpp:
http://pastie.org/private/d9tmw7lpcuolmsrcv9yha

.h:
http://pastie.org/private/icm2cexrxcovcljsasjmrq

Sorry, I use tabs spacing so none of the paste sites look right with the code.
« Last Edit: August 22, 2013, 01:57:08 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/

Gamh

  • Contributors
  • Loreweaver
  • *****
  • Posts: 81
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #2 on: August 19, 2013, 04:24:53 pm »
Quote from: "relaxok"
If you were to have a tool like this, what are the primary outputs you'd want, say besides PNG?  Is that good enough?  What about the other mipmaps beyond the base level?  What about other features?

PNG should be enough for anyone interested :) And for WoW modding I don't think people care about mipmaps.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #3 on: August 19, 2013, 04:40:20 pm »
Quote from: "Gamh"
Quote from: "relaxok"
If you were to have a tool like this, what are the primary outputs you'd want, say besides PNG?  Is that good enough?  What about the other mipmaps beyond the base level?  What about other features?

PNG should be enough for anyone interested :) And for WoW modding I don't think people care about mipmaps.

That's what I figured...

Just basically finished it now.. i've got .BLP to .PNG or .TGA, and i've got anything stb_image loads to .BLP.

Currently I am outputting DXT5 .BLPs.. but I don't really think the BLP settings should matter very much.. there's no reason now to use crappier settings unless you're worried about disk space with your modding.. maybe it should even output uncompressed.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #4 on: August 23, 2013, 09:36:17 pm »
I've done some more research on this.  DXT compression is natively used in modern GPUs and only uncompressed at a very late stage in the pipeline.  Overall it is faster performance to use them, not just smaller size.  And for something like terrain or models, you can't tell the difference between them visually.

Learn something new everyday..

I am working on moving the texture conversion features to my main converter app which I would like to release very soon.  I will make another thread on it with d/l link when it is available.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #5 on: September 06, 2013, 11:29:12 am »
A long shot but dds file formats to blp would be interesting.  Given that they use DXT compression as well but I don't know too much about their structure so I can't say for sure.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #6 on: September 08, 2013, 11:09:13 pm »
Quote from: "AnthonysToolbox"
A long shot but dds file formats to blp would be interesting.  Given that they use DXT compression as well but I don't know too much about their structure so I can't say for sure.

I'll add this for sure.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/

Gurluas

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 344
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #7 on: September 24, 2013, 03:23:33 pm »
Will this be able to convert the advanced MOP BLP, like the Battleship sail texture?
In the old BLP program it came out as a wireframe.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #8 on: September 30, 2013, 10:22:50 am »
Quote from: "Gurluas"
Will this be able to convert the advanced MOP BLP, like the Battleship sail texture?
In the old BLP program it came out as a wireframe.

What BLP are you referring to?  That sounds extremely interesting.  What is the name and name of model that use it?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #9 on: October 01, 2013, 02:38:35 am »
Gurluas, I would like to know this too.. where is this .BLP in mop data?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/

PhilipTNG

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 709
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #10 on: October 01, 2013, 09:08:09 am »
Quote from: "Gurluas"
It belongs to the MOP Battleship.
Here it is:

https://dl.dropboxusercontent.com/u/952 ... _SAILS.BLP

When converted to a PNG it's just wireframe.

The texture is the sail for this ship:

Those are simple to get around, you just need to switch it's format then turn it into a PNG.. I had this issue when I was modifying Cataclysm's Title Screen a year ago and noticed that the image appeared fine in Adobe ImageReady however in windows explorer and photoshop itself it wasn't.

After an hour or so of trying to hex edit the PNG file with no luck,  I just tried modifying the BLP's format and lo'and 'behold.... just changing it to the Non-Alpha versions fixed it.  ^_^.... so naturally the easiest way to do that is just converting it to a DXT1 or RAW0 format with a converter that has that sort of option.

To Gurulas:

[youtube:30ouis60]http://www.youtube.com/watch?v=1exv2Rm4kAU[/youtube:30ouis60]

And just some food for thought, Alternatively you can just convert the Wireframe PNG File into a non-alpha'ed DXT1 DDS File which would give you a colored file and not a wireframe, then that back into whatever format you want.  Or Convert the Wireframed PNG into a DXT1 BLP,  it all works the same.. as I said, it's just Food For Thought.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

relaxok

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 74
    • View Profile
Re: [TOOL]  A new BLP Converter
« Reply #11 on: October 02, 2013, 11:58:28 am »
Anthony - that's interesting that it works, but it brings up questions about the BLP format.

What about the BLP header suggests that this needs to be done?

As far as I can tell, it's just alpha encoding 7 which is DXT5 but no different than other DXT5 textures in the data..  might be missing something though.  Alpha depth is 8 but I'm ignoring it for compressed textures.   Libs like squish have no option that would seem to result in the correct color.

(i also get a wireframe)

Edit: Hmm, I see there is some difference between DXT1 with no alpha and with 1 bit alpha... the lib i'm using to decompress dxt textures does not have a mode to differentiate those things.  I guess I will have to write my own if I want to be able to handle such files, however I still don't know how the BLP format differentiates "DXT1_A0" vs "DXT1_A1" to use the terms from the video.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
----------------------------------------------------------------------------------------------------------------------------

My project blog: http://relaxok.tumblr.com/