Author Topic: BLB Brick Format Reference  (Read 76858 times)

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.


BRICK

2x4.blb
Code: [Select]
2 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.


SPECIAL

2x2ramp.blb
Code: [Select]
2 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 Grid

2x2ramp.blb
Code: [Select]
XX
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


COVERAGE

2x2ramp.blb
Code: [Select]
0
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


Quads

2x2ramp.blb
Code: [Select]
----------------top quads:
1

2x2ramp.blb
Code: [Select]
----------------bottom quads:
5

2x2ramp.blb
Code: [Select]
----------------north quads:
1

2x2ramp.blb
Code: [Select]
----------------east quads:
2

2x2ramp.blb
Code: [Select]
----------------south quads:
1

2x2ramp.blb
Code: [Select]
----------------west quads:
2

2x2ramp.blb
Code: [Select]
----------------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.blb
Code: [Select]
TEX:TOPThis 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.


POSITION

2x2ramp.blb
Code: [Select]
POSITION:
-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)


COLORS
Road Baseplates
Code: [Select]
COLORS:
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 COORDS

2x2ramp.blb
Code: [Select]
UV 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)



NORMALS

2x2ramp.blb
Code: [Select]
NORMALS:
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.
« Last Edit: October 28, 2015, 11:04:02 AM by Badspot »

These sections define how many 'quads' (4-sided textures faces, more later) are in the brick, and what side they relate to.


Seems like a some what accurate overview, I think if Badspot over viewed this and fixed any errors it should be sticky'd. Reading through it puts me off trying to attempt to make bricks via .blb, though tempting I think I'll save my brain and let some one else who's got the spare time to do such things  :cookieMonster:

This topic explains a bit more.  I think any person who could make bricks right will be able to using this topic and mine: http://forum.blockland.us/index.php?topic=40314.0



Also, your missing the bottom 1x1 round texture.

The bottom of the 1x1 round uses several quads with BOTTOMLOOP as its texture.

I swear I saw the texture for the 1x1 round in the blockland files....oh well.

- is for allowing other bricks in that area, look at the tree for an example.

Oh, right. In v8 I kept getting 'overlap' when I tried to place bricks in those areas, so I wasn't sure.


Sweet, this finally got stickied.

You're missing the SIDE texture.


Also, in the case of road baseplates, there's this:
Code: [Select]
COLORS:
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

(First row, left to right) First value is the Red, second is the Green, third is the Blue and fourth is the Opacity.
Every vertex has it's own colour. So if you have two pairs of vertexes with different colours, one pair black and one pair white, you get this:


I think this is the same with the window bricks.

Also, I may have some stuff wrong. I've only examined it for like five seconds.
« Last Edit: September 14, 2009, 12:45:28 PM by Bill.Gates »

I'm absolutely sure I wrote most of these things in. Maybe I wrote a different reference thing somewhere...

I love you.
Anyways, I'm trying to create a 4x4 Round Brick
(http://i2.ebayimg.com/07/i/001/57/83/8fc3_1.JPG)
How exactly do rounds work?
Would the Brick Grid be something like this?:
Code: [Select]
XuuX
XXXX
XddX

XuuX
uuuu
uuuu
XuuX

What would the quads be? What would the UV cords be? What would everything else be?

Also, in the case of road baseplates, there's this:
Code: [Select]
COLORS:
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

The road bricks! I was looking for a way to color quads forever. Thanks for this!