This is my interpretation/understanding of the BLB file format from basically reading through the files. Please tell me if you think I'm going wrong on any part of this.
BRICK2x4.blb2 4 3
BRICK
The
BRICK code-word shows that the brick is a standard, cuboid-shaped brick. The numbers above it stand for its length (studs), width (studs) and height (plates, not bricks). The above code is for the 2x4 brick.
SPECIAL2x2ramp.blb2 2 3
SPECIAL
This defines the basic width, length and height of the brick as if it were a standard brick (no parts 'cut out'), which is used later. The above code is for the 2x2 ramp.
Brick Grid2x2ramp.blbXX
XX
dd
uu
XX
dd
Each of these define whether people can place bricks inside, on top of or above the brick. The basic view is each layer of its cross-section, one for each brick in length along the y axis set on the first line. For this code (the 2x2 ramp), this consists of two sections which are each two characters wide and three tall.
X = Cannot place bricks in or on top of this
u = Cannot place bricks inside this, but can on top of
d = Cannot place bricks inside this, but can below
- = Bricks can be placed inside of this area.
b = Cannot place bricks inside, but can on top or below
COVERAGE2x2ramp.blb0
COVERAGE: //TBNESW
1 : 2
1 : 4
0 : 6
0 : 6
1 : 6
0 : 6
The number on the left of the : is whether or not it will hide adjacent faces. The number on the right is the coverage area of an adjacent brick to hide a face on this brick. The 4x2 plate would infact look something like this:
1 : 8
1 : 8
1 : 2
1 : 4
1 : 2
1 : 4
Quads2x2ramp.blb----------------top quads:
1
2x2ramp.blb----------------bottom quads:
5
2x2ramp.blb----------------north quads:
1
2x2ramp.blb----------------east quads:
2
2x2ramp.blb----------------south quads:
1
2x2ramp.blb----------------west quads:
2
2x2ramp.blb----------------omni quads:
1
These sections define how many 'quads' (4-sided faces, more later) are in the brick, and what side they relate to. The
direction quads will be hidden and not rendered when the entire brick is covered on that side by other solid bricks (areas defined by the COVERAGE section) - faces that are not on the edge of the brick or are tilted should go in
omni quads.
TEX:2x2ramp.blbTEX:TOP
This defines the texture that the particular quad has.
TOP = Brick studs
BOTTOMLOOP = Brick underside texture
BOTTOMEDGE = Brick underside edge texture
SIDE = Brick side texture with shading on each edge
RAMP = Rough 'ramp' surface
PRINT = Print texture, when the brick is 'printed'. Extra fields in the datablock will probably need to be added to let the print brick function.
POSITION2x2ramp.blbPOSITION:
-1 -1 1.5
-1 0 1.5
1 0 1.5
1 -1 1.5
This section defines the four corners of the 'quad' face. If only a triangle shape is needed, set two to be at the same position. The points are connected in clockwise order, determining which side of the face it is visible from. (eg you can't see a brick while inside it)
COLORSRoad BaseplatesCOLORS:
0.200 0.200 0.200 1.000
0.200 0.200 0.200 1.000
0.200 0.200 0.200 1.000
0.200 0.200 0.200 1.000
This section defines that the face and vertexes should be blended to that colour (RGBA decimal) instead of the paint colour. Examples include window bricks and the 32x road baseplates.
UV COORDS2x2ramp.blbUV COORDS:
0 0
0 1
-2 1
-2 0
These define which point on the texture to draw from. Each one is a set of two co-ordinates, which match up with the corners under
POSITION. 0 is the far left or top of the image. 1 is the far right or bottom of the image. Negative numbers will make the image loop that many times. (For instance, this defines the top of the 2x2 ramp brick, which has two studs drawn in one quad, because it loops twice)
NORMALS2x2ramp.blbNORMALS:
0 0 1
0 0 1
0 0 1
0 0 1
Used for lighting. The three co-ordinates should define a vector of length 1 perpendicular to the surface at that point. If the face being drawn is tilted, you may have to use trigonometry to find the direction for this to point in.
In general, all four of these are the same, but in rounded bricks they can differ, in which case each normal affects points in the same order as in
POSITION. Rounded bricks use this to have smooth shading between different vertices on the same quads.
Again, this is only my understanding of the format, and some parts may be inaccurate/wrong. I hope this helps some people trying to create new BLB files, if at least a bit.
From my experience of making them, it takes a long time and will probably go wrong the first time. Check bricks from
all angles to ensure they look right and line up correctly with other bricks.
EDIT: Corrections.