Author Topic: i can't seem to figure out how to texture a brick correctly  (Read 1879 times)

preface: i've never made a brick before and the only reason i'm doing it now is for a build i'm working on privately.

so i have everything else set up fine with the model but once i texture it it never comes out right, can someone tell me how to do it?

Top, bottom, or side textures?

What exactly are you having issues with?

Alright bitch

When calculating the UV coords for textures 0 0 is the top left of a texture, 1 0 is the top right, 1 1 is the bottom right, and 0 1 is the bottom left of the texture. The order of the UV coords follows the order of the quads. Decimals cause the textures to be cropped, and negative numbers cause the textures to be flipped. You can use any combination of decimals and negative numbers and if the differences between the UV coords on separate quads are greater than 1, the texture will be repeated that many times between those quads.

It really helps if your quads in the model are all in the same order
First quad: Top left
Second quad: Bottom left
Third quad: Bottom right
Fourth quad: Top right
The face will still be rendered facing the correct way if 1 or 2 quads are flipped and you can fix backward textures by reordering the UV coords, but it's much easier if they are all in the order above as this is also the standard set by default BLB's.

Top Textures - TEX:TOP
In order for the top textures to align to the brick grid they actually need to be flipped along both the X and Y axis with the bottom left corner quad being the top right of the texture (with north being at the top of the screen)
Doing bottom textures is pretty hard to do without being able to plot 3D-points in your head. To do bottom textures correctly you'll need at least 4 quads if you haven't already modeled them. The edge textures extend 0.5 units from the edges of the brick while the loop textures (if the brick is larger than 1x in either dimension) start and end 0.5 units from the edge.

The edge loops should loop x times on the outer edge and x-1 times on the inner side (the side that touches the bottom loop) and should only loop 0.5 times on their width (the bottom half of the bottomEdgeLoop texture should never be visible)
The inner loop should loop x-1 and y-1 times to get it to align with default textures, but if you want to say forget it and have it actually align with the bricks like I did with Brick Tessellation add whatever the inset you used to all the UV coords.

Side Textures - TEX:SIDE
This requires some algebra, the magic equation is as follows

X is how many units wide the texture is, to calculate the Z height divide the height by 2.5 before plugging it in. This isn't exactly how default bricks do it, but it's close enough.
Basically for side textures to align on all bricks regardless of the size of the face we need to zoom in on the texture and crop out a small percentage of the edges.
Instead of using a UV coord of 0, subtract the above equation from 0
Instead of using a UV coord of 1, add 1 to the above equation.
« Last Edit: May 22, 2018, 02:26:06 AM by DurkaDude »

or you can drop all the math and wing it by setting the render mode to material, assigning the texture to the material for the relevant faces, and then adjusting until its right.
Assuming that you're making your brick in Blender and using Demians exporter.

you can use my cinema screen bricks to see how to do print uv mapping properly in Demian's exporter. Note that its exactly the same process for mapping top/side/bottomedge/bottomloop textures, just with a diff texture file and material name.

jasa's method is if you were making your brick by editing the .blb. while technically feasible, its a /lot/ more work and a lot harder to do, and since you said "model" im assuming you aren't doing it like that.
« Last Edit: May 22, 2018, 12:59:24 PM by Conan »

it worked, but the brick is an off white that can't be colored

it worked, but the brick is an off white that can't be colored
add blank to the material name, after a space so its a standalone word. order with the texture name shouldnt matter