631
Modification Help / Re: i can't seem to figure out how to texture a brick correctly
« on: May 22, 2018, 01:23:20 AM »allAlright 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)
Bottom Textures - TEX:BOTTOMEDGE, TEX:BOTTOMLOOP
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.