Boy oh boy!!! Manipulating textures is a lot harder than it use to be! With that exclamation out of the way, let’s get into my solution. Well… It isn’t quite my solution. I’ve pulled the information from multiple sources, but remembering what part of what came from where is too much for me to add to this. I think anyone else reading this might rather the solution than the sources all the bits and pieces came from.
As someone pointed out earlier, you can use WorldAlignedTexture to get perfect walls, but they were not quite so perfect as I found out. The biggest issue I had is that if you wanted a wall that was, let’s say, 30 degrees off from world square, it would do strange things with the texture, so rotating the walls would really mess up the texture. As can be seen by this picture.
I have, however found a solution that will work for me. From here on out, you can call this a tutorial of this solution.
For this, I have been working with the Starter Content Material called M_Brick_Clay_New, so much of this is the exact same, although you can apply the same tiling principles any Material, in theory. That has yet to be tested. I’ll go with any material that is intended to be used as a brick wall.
Let’s take a look at the walls.
In this picture you can see 6 different walls. The one on the left, separate from the crowd is a BSP Box wall. The 3 in the center are Basic Cube walls and the one to the right is a Static Mesh wall from the Starter content Architecture folder. Believe it or not, the wall on the right is actually Wall_400x200 that I have Stretched the wall wider and taller just to prove the point of how the material is now working.
Looking at the BSP wall (far left) you would think that it was a different material or sized differently, but in all actuality the BSP wall is the exact same as all the other walls. Apparently the UV sizing used in this material doesn’t work on BSP the same as it does for Basic Cube or Architecture Walls. Because of this, I do not find that BSP would be very good to use with this method as it still stretches no matter which direction you stretch it in.
Since we’re taking BSP completely out of the equation, let’s take a look at the remaining 5 walls a bit more closely…
The above image is 4 walls of Basic Cube with the Y scale set to 0.25 giving us the thickness of our wall, however this can be set to any number you wish to use for wall thickness. I used 4 of them to show how well they line up when you butt the walls end to end. These walls can now be resized taller, shorter, wider or skinner without stretching or compressing the texture on the wall surface that we can see. However, there is still a slight problem with this wall. Let’s take a look…
When we look at the wall from the top left corner we can see that the wall’s thickness does show compressed brick and not one single brick as one might expect. The top wouldn’t be much of a problem. That can easily be covered up with a roof or something of that nature, but the sides however, They would typically be player viewable. You might be able to come up with a way to cover them up, but I very well might want the corners of my structure to be squared and not covered up. That’s the only real down side of using a Basic Cube. Besides that, the Basic Cube Walls and the Architecture wall (far right) look pretty similar. There is one other minor annoyance to using Cube and that is when you resize, the resizing is based on the center of the cube, so you have to resize to the size you want it, then move the wall so it’s flat on the ground and all the mortar lines up again.
The Static Mesh wall, like the Basic Cube wall can be resized wider, skinnier, taller and shorter without loosing it’s texture as it is. Now let’s take a look at the Static Mesh wall from the same corner perspective as we have looked at the Basic Cube.
From this perspective, we can see that the player viewable portion of the wall now looks like a single brick. Now this portion of the wall will stretch or compress if you make the wall thickness wider or skinnier, but all in all, this out of the package architecture wall appears to look pretty good and shouldn’t really need to change how thick the wall is. It still has a minor issue with the top of it that I have yet to be able to figure out a way to look right, so it might not be good for a short wall where the player can see the top of it, however for housing or industrial building structures that the top will covered anyway it’s pretty good. I would be happy with this one… FINALLY!
If anyone reading this knows how to fix the top to line up with the rest of the bricks I would love to hear about it. That would make for the perfect brick wall.
This is the best I’ve been able to do through researching wall texture sizing without stretching the last 4 days.
Now to the big question at hand. How was it done?
First things first. I would suggest if you’re going to play with this, make a copy of M_Brick_Clay_New and work with that so you always have a reference back to the original if you do something that you may have to go back and fix.
Now let’s take a look at the material as it is now, which I have named My_Brick_Clay_Align_Works.
I made a point to comment where appropriate for any other noobs like myself trying to learn. The overall Material is broken down into 3 main sections. Texture Variation, The Texture itself and Texture Depth.
The Texture Variation gives us an added look that the surface of the bricks are not perfectly flat. The Texture of the wall, is fairly simple and self explanatory. There’s plenty of tutorials already on the use of Normal to give some depth to your 2D texture. The Texture Depth portion on the bottom adds more depth to the brick than what you get with normal alone.
For the most part, all 3 sections are controlling the texture in the exact same way. The only difference is the input we give it varies between them, so I’m only going to walk through one of these sections. You can see from the overall Material how the rest is put together. So let’s take a look more closely at the Wall Alignment of Texture section in the middle.
Here you can see the UV adjustments on the left and it’s box is highlighted. Changing Utiling will make the bricks wider or skinnier, changing Vtiling will make the bricks taller or shorter. it’s currently set to 0.25 for both and they seem pretty well balanced keeping both numbers the same. You can play with these to see how they affect your material when applied.
I hope the actually aligning of the texture is pretty self explanatory. This portion was taken from another tutorial and it’s seems to do the job pretty well. The way I set this was was to search the Palette for each of the given key words BreakOutFloat2Components, ObjectScale, Multiple x2 and Append then arrange and connect them in the fashion shown.
You will want to duplicate this for the other 2 sections giving Texture variation and added Texture Depth as shown in the full Material. Each of those sections have their own UV controls. I kept them the original values from the original M_Brick_Clay_New material, however you can adjust these to get a different look and feel to the surface and depth of your bricks.
Using this method, you can do a full 360 rotation of a wall without any distortion of what it should look like as well.
Beyond that, everything else is the same as the M_Brick_Clay_New Material and you can use that for reference of how everything else is put together.
This may not be the best method, but for a guy just learning himself, this alone feels like an accomplishment. I’m quite sure I’ll be using this method for quite a few things, until I come across something better.
If you know of a better method and it’s given in enough detail that a noob can understand it, I would love to hear about t.
Peace,
RJ