Blizzard's BLP image format

Started by
14 comments, last by Vexorian 18 years, 6 months ago
In Warcraft 3 Blizzard uses their own image format - blp which contains multiple JPEG images with a shared header, one per mipmap (the mipmaps are stored in the image). Now each image shares one single header so to construct a JPEG image you append the header with any of the mipmap blocks and you get a usable JPEG image. I've written a loader that does this and it works fine. The problem however is when I'm trying to write a saver for this image format. How do you create jpeg images so that all mipmaps use the same header? Blizzard managed somehow, but I'm not sure how. I naively tried to take the header of the first mipmap but when appended to the others it generates screwed up images all of the size as the first one. I'm not surprised, since they use the same header. Does anyone have any ideas? If the width/height information lies in the header, how can one single header be used for all mipmaps (which has different sizes)??? I'm kinda lost here!
----------------------------------------MagosX.com
Advertisement
Can't you assume that successive mipmaps will have their height and width divided by 2?
they actually use JPEGs for textures??!!
Well if your loader works, what did you do for size in the loader? Anywas there's probably some procedural interval. Like half the size as the previous or something. Or it's in the header but I have no idea but try it out, I'm sure you'll get it eventually.
I guess my question is, after generating the first mipmap how can I generate the next mipmap so it uses the same JPEG header as the first? If I generate another image it won't have the same huffman tables etc... as the previous, right?
----------------------------------------MagosX.com
Quote:Original post by Code-R
they actually use JPEGs for textures??!!


You seem surprised, why?
for one, it's lossy, the bad way, not DXT way:
http://www.sjbaker.org/steve/omniv/jpegs_are_evil_too.html
Quake 3 used JPEGs for non-alpha blended texturing as well, I didn't see any really bad artifacts there.
wasn't Q3A using TGAs?
*checks* Nope, JPEGs. There are TGAs in there too, but mostly JPEGs.

This topic is closed to new replies.

Advertisement