BBLM (File Format)

From Custom Mario Kart
(Redirected from BBLM)
Jump to navigation Jump to search

The BBLM (Binary BLooM) filetype controls blur, bloom and color filtering of the final image output.

File Description

The result of the threshold operation
The result of the first blur
The result of the second blur
The final image output after applying bloom

The game handles bloom by going through a number of stages whereby each stage alters either the original image (the output without posteffect) or the result of a previous stage in its own way. The four main stages are threshold, blur, bloom and tinting. Each stage and its own steps are described below.


The threshold stage is the first one to be executed by the game. It works with a grayscale and the fully colored version.of the original image. It performs a thresholding action by subtracting the product of the threshold intensity and the threshold color from the grayscale image. This means that it is also possible to filter out specific color channels, although Mario Kart Wii itself only uses grayscale colors as threshold. The exact purpose of the threshold intensity is unclear, since the BBLM file already gives full control over the threshold color. The resulting image - a darkened version of the grayscale input - is then multiplied with the colored input to create a darkened color image.


BBLM supports up to two distinct blurs, with the second one supporting 4 stages. The BBLM format, however, only supports 2 stages in the second blur and any attempt to add more stages will cause defects. Mario Kart Wii applies blur by translating the input image in a circle around its original location. The first stage in both blurs divides this circle in 8 steps, the second stage uses 16 steps. All steps are added together into one final result, with the blur color intensity (values 0.0 to 1.0) determining how much the final image is darkened and the blur strength determining what radius is used for the circle. Note that an intensity of 1 will make the final result too bright, since the blur operation adds 8 variants of the same image together. The second blur takes the result of the first blur as input and is then repeated with its own output.


The bloom stage contains two substages: the first substage combines the result of the two blur operations (A), and the second stage applies a threshold of 50% (so 127 is subtracted from each color channel) to the original image and makes the result four times brighter (B). The final result is calculated using the following formula: (1-B) * A. So the brightest parts of the original image darken the blur, which makes blur only cover the darker parts of the original image.


Tint is a fairly simple stage. Once the final result is generated, tint adds a color filter over it, which works just like a vertex color. The most noticable usage of this tint effect is the cave in Mushroom Gorge, which is given a green ambience by this stage.

File Format

Offset Type Description
0x00 String File magic. Always PBLM in ASCII.
0x04 UInt32 File size. Always 0xA4 in MKW.
0x08 UInt8 Version. Always 01 in MKW.
0x0C UInt32 Unknown. Always 00 00 00 00.
0x10 Float Threshold intensity
0x14 Byte[4] Threshold color
0x18 Byte[4] Tint color
0x1C Short Bitfield
0x20 Float First blur strength
0x24 Float First blur color intensity
0x28 Uint32[6] Unknown. Always 00 00 00 00.
0x40 Float Second blur stage 1 strength
0x44 Float Second blur stage 1 color intensity
0x48 Uint32[6] Unknown. Always 00 00 00 00.
0x60 Float Second blur stage 2 strength. Unused, since the value from stage 1 is used instead.
0x64 Float Second blur stage 2 color intensity
0x68 Uint32[6] Unknown. Always 00 00 00 00.
0x80 Uint8 Determines how the generated output image (source) is blended with the original image (destination). Source and destination are always added together.
Value Output
0 No modifications.
1 The source is multiplied with its complement (inverted color), thus discarding the brightest color channels.
2 The tint alpha determines the transparency of the source.
3 Same as 2, but the destination is multiplied with the inverted alpha, creating a weighted average.
4 The source is multiplied with itself, emphasising the brighter colors.
0x81 Uint8 Number of blur stages in the second blur.
0x9c Float[2] Bloom color intensity per stage


The following tools can handle BBLM files: