www.leetlegacy.tk/brickmaking.html
This is for General's.
It's pretty darn rough in organization and everything, but I think I covered everything that needs be. Maybe.
I also made this tutorial before I covered quad sorting so that's a loss as well.
In the case of rectangular faces, the texturing is going to be stretched. You need to manually adjust the UV texture in UV/Image Editor per face. There is no actual algorithm for this
There is.
What we know:
- The side texture is 512x512 pixels.
- The border is 11 pixel wide.
- A brick face of 1x1 TU (2 studs wide 5 plates high) has an unstretched texture.
This leads us to the following formula, w and h being the width and height of the face in torque units:
Bottom left point:
u = 11 - (11 / w)
v = 11 - (11 / h)
Top left point:
u = 11 - (11 / w)
v = 512 - (11 - (11 / h))
Top right point:
u = 512 - (11 - (11 / w))
v = 512 - (11 - (11 / h))
Bottom right point:
u = 512 - (11 - (11 / w))
v = 11 - (11 / h)
Note that these are pixel coordinates for entering in blender. If you need fractions for the blb file just divide the results by 512.
This will give you side textures exactly like the default bricks.
For example, 1x1 plates (face is 0.5x0.2 TU) next to a 1x2 brick (texture is 1x0.6 TU)