The BRender Technical Reference Manual wrote:br_pixelmap * index_blend
Blending is a way of making the destination pixel depend upon the existing contents of the output buffer. The blend table like the shade table tabulates the output pixel given a particular texel and the pixel already in the output buffer. The texel indexes the column and the existing output pixel the row. The shade table must therefore have the full complement of rows as well as columns necessary for the pixel size of the texture map.
Thus an 8 bit indexed colour texture map blend table needs 256 columns and 256 rows. The blend table is only used if BR_MATF_BLEND is set, and if set this member should not be Null.
Given that the blend table tabulates an output for every possible pair of input pixels, any function can be represented, e.g. exclusive-or, inverse, inclusive-or, mask, average, etc.
The blend table is typically used for translucence effects, e.g. ghosts, flames, frosted glass, etc.
Note that in the case of the depth buffer renderer, while the output pixel will only be written if it is nearer than the existing pixel, it will never modify the depth buffer value. This is because it is assumed to be an intangible surface. Therefore, it may be necessary to render such materials in a separate stage.
Note that if both a blend table and shade table is used (the material has an indexed texture which is lit and blended), the shade table is applied first, followed by the blend table.
Blend tables, as with shade tables, also need to be added to the registry before use.
3. BLEND TABLES
The lesser known and most interesting one. The three main blend tables BLEND25.TAB, BLEND50.TAB and BLEND75.TAB were first made use of in the Splat Pack expansion to achieve 25% 50% and 75% transparency on materials featuring '\25' '\50' and '\75' in their identifier. But it's possible to load custom ones within materials of track geometry, accessories, and somehow cars.
The trick is easier to achieve than with shade tables: you have to create a new blend table (
256x256), store it Data\SHADETAB, make it load from within the car/track txt file and finally edit the .MAT file with an hex editor to add a the blend table within the materials.
To do this, you have to insert a bit of data very similar to the chunks that load the pixelmap and the shadetab:
Code: Select all
0000001C00000000424C4E44464C4D302E70697800
0000001E00000000424C4E44545354332E54414200 <- this is the part to add
0000001F0000000B445252454E4445522E54414200
This basically reads like so:
Code: Select all
colour_map = "BLNDFLM0.pix";
index_blend = "BLNDTST3.TAB";
index_shade = "DRRENDER.TAB";
The
1E byte in the example above is the important bit as it specifically tells the game to load and use the blend table. If you have a good eye, you'll notice there's no chunk starting with the
1D type byte and you're probably thinking "here's your index_fog!" Well I tried and didn't get any result, so I don't know :(
As previously mentionned, blend tables are
256x256 pixels, both width and height corresponding to the colour palette this time as they're meant to define the result of any possible colour blending within the palette. You can see it like that: the range represented by the width are the colours closer to the camera, while the height covers the colours behind. I guess the visuals below will be easier to understand. Once again it's possible to get very creative once you grasp how it works.
There seem to be some limitations ofcourse. Firstly the blending effect don't seem to apply properly to some actor types depending on the one holding it. For example, blending materials on cars won't blend with track materials. Some blending materials loaded on materials will also not blend with materials from another noncar. Secondly it seems like there is a total amount of blendtables that the game can load before it starts to display the effects sporadically (the materials might flicker). Keep in mind the game might want to try and load the main BLEND25.TAB, BLEND50.TAB and BLEND75.TAB. Not renaming Plaything2's generated main track actor identifier (as we do precisely to enable the transparent blend tables) helps in that regard.
Finally, some kind of conflict prevents blending car materials against the track's materials and instead render them fully transparent. It appears like the blending material must always be applied against another textured component behind it. I'm still investigating this. You can check the Subaru Impreza for an example in the reflections material.
annex 3: downloadable blend test level (as CTT #7).
annex 4: video and stills illustrating three effects achieved through blend tables on twitter.
fig.8: BLEND50.TAB, used to apply 50% transluency.
fig.9: BLEND50.TAB applied on a car's main material and the resulting visual glitch. (Disregard the red backdrops.)
fig.10: Illustrating a custom flame transluency setup.