How to Tile a Material Based on Object's Scale Without Using World Alignment?

So, some context for why I cannot use the World Alignment Node for this material. The World in this game will rotate, so the physical location of the walls/objects will be changing all the time. This means that the texture will be constantly changing on what’s supposed to be a static wall. I need to use something like the Object Scale Node that will allow me to take the static scale of the object and keep the same UV Coordinates no matter where the actual object is in the game.

This is what the wall should always look like: Bricks_Normal.png
This is what the wall looks like when it rotates (With World Alignment): Bricks_Broken.png
This is what I am currently doing in its material graph (With World Alignment): Bricks_MaterialBP.png

I’ve looked all over the documentation and forums, and nothing has helped me yet. I cannot find a way to tile consistently without using any kind of World Alignment Node. Any help would be appreciated.

well did you try to multiply your TexCoord with the object scale node?

I’d be asking the same thing XD

Yeah, I tried doing that and then using that as the uv for the textures, but that just turns the whole thing black. It makes all the materials disappear. Is there an example of how you would do what you’re suggesting?

Edit: I did also try just doing it with just the X and the Y values since texture coordinates is a float2 value. That work for the respective axis’s but it’s unable to account for the Z axis at that point. Any time I try to add in the 3rd axis, it all breaks.

1 Like

still the way to go, but the output of the object scale is most likely too big. multiply it by a small factor and you should start getting something

I’m still not sure what you mean exactly. If I grab the Scale XYZ then multiply that by the texture coordinates node, then use that as the UV for the texture, it breaks because it’s trying to multiply a float3 value (Scale XYZ) by the float2 value which is the texture coordinates. Even if I make the input from the Object scale really small, it just mathematically doesn’t work. And, if I make a float2 value from 2 of the scale values (For example X and Y), that still leaves the Z axis unaccounted for. So 2 of the 3 axis’s work properly, but the 3rd is still stretched. I have tried using the LocalAlignTexture Node, thinking that it was the local version of the WorldAlignTexture Node, but it only has 2 inputs, and doesn’t even work. It doesn’t cause any change in the texture mapping.

1 Like

multiply the scale x with the scale y and then with the scale z. this will give you a ‘general scale’ factor. then multiply that with a very small number (start with 0.001, play around with it). and then multiply that with your texture coordinates

When I try that, it still gives me a stretched texture effect that is still not uniform with its scale. It’s still small on some objects, but large on others. It’s not uniform.

sorry my bad. you need to divide by the scale node, not multiply it
that’s what happens when I try to help out of memory and not trying the stuff :smiley:

I am way late to the game, however I did not see a proper solution here. I originally did this - Auto-Tile UV from Bounds posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4 - and found this post looking for a cheaper solution as this was costing me 161 instructions using 2 different textures (x1 for Z-Plane, x1 fo X & Y Planes). This solution will scale the textures seperately according to the x, y and Z Object Bounds (I should have just used scale node, but did not know it exist at the time). There is also parameters to adjust global scale and x, y scale separately. This uses x3 IF nodes on the VertexNormalWS node to separate the planes and scale each plane properly.