Scaling meshes without stretching their textures

This is likely a very simple question, but it’s posed in an extremely roundabout way due to my inexperience with graphics. I’m basically trying to assemble a very crude mockup of a city street, and I had assumed that it would involve lots of long, wide cubes to serve as the basic surface for streets and building facades, and lots of small props and decals to break up the monotony. However, I’m finding that even very simple textures look awful when I try to scale them. As an example, here’s my latest attempt at the street. It looks fairly decent, for a low-effort prototype:

The problem is, if I highlight what I actually used to make this, you’ll notice that the actual pavement is a boatload of 1x1x1 cubes:

This feels like a really cruddy workflow: it’s labor-intensive, slow, and extremely repetitive, and if I want to nudge one small thing, it necessitates selecting a large number of blocks and moving them. This brings us to my very first attempt, where instead of 25 1x1x1 blocks, I tried to use a single 25x25x1 block with the texture applied:


This looks terrible by comparison, because it’s taking a texture meant to be a small bit of pavement and blowing it up. If the pavement is longer than it is wide, something that’s true of nearly all streets, it goes from slightly bad-looking to outright unacceptable, because in addition to being blown up the texture is suddenly grotesquely distorted along the long axis.

The same issue applies to building facades, bridges, and really anything you would want to apply a single base texture to. I’m sure this is a very simple concept for level design, but how am I supposed to deal with this? Is there a setting somewhere on mesh primitives I can use to tile a texture instead of stretch it? Does this have something to do with the texture itself not being properly designed? I’ve had a lot of people advise me that building modular parts and assembling/kit bashing levels inside the editor is the cleanest workflow, so there must be an obvious way to handle this that I’m not thinking of.

1 Like

I think you scale (tile) textures with the TextureCoordinate node. I certainly see options for tiling in there. Will this help?

https://docs.unrealengine/latest/INT/Engine/Rendering/Materials/ExpressionReference/Coordinates/index.html#texturecoordinate

This setup will keep your tiling right:

Oh hey, thank you!! The result should be plugged into the UV of each texture sample, right? My only question is about the Tiling node, what exactly is that? I’m not seeing it on the contextual popup…

That looks intresting

I believe that’s a Scalar Parameter that’s used to Multiply the UVs.

Ooh, that makes sense… does this look right? I think I messed something up, because when it renders, I lose most of the detail from the texture- it just looks like a uniform matte grey.

Yep into the UV of your textures.
The tiling node/scalar parameter is here to scale the texture

Make sure that you use a right default scale for your texture -> the scalar parameter

How do I actually determine the default scale, do I set it to match the scale of the mesh? That’s something that’s been confusing me with both the scalar component and texture coords- I see the scale measurements, and I see they have an effect, but I have no idea how to intelligently manipulate them beyond entering random numbers and seeing how it looks.

Start with small numbers and go up. The easiest way to think about scaler is as a type of multiplication. When you set 1, that sets the texture at the same as you had in the first post. 2 will ensure that the texture maps to the UV twice. 3 Thrice. and it increases at the same rate that you would expect with multiplication.

Using higher numbers has a performance cost, so you should find a place were it looks good to you. If you liked the way it looked while you had 25 blocks, then start with 25 as your scaler value. This should give you the exact same result as you had at that time. You can increase and decrease it from there.

Multiplication can be thought of as a scaling factor. If you have a belt that is 6 inches, and multiply it by to to get 12 inches, you stretched the fabric to be twice as long. This is different to Addition, where you would have added a second 6 inch belt to achieve the same result.

That is what you are doing by making the 25 blocks into on block. You are stretching that one block to cover the space of the 25 previous blocks. Think of the Texture like a rug, and previously, each block had its own rug. If you want to fill the same space, you still need the same number of rugs in order to cover the same amount of ground.

By setting the scaler to 25, you are saying that you want to use that image as a “rug” that is 1/25 the size of the block, and to simply use an exact copy of that “rug” on every other part of that block.

Does that help?

This doesn’t get into texel density, which is making sure that every part of the world is covered by mostly the same amount of detail. That is fun for another time.

That helps a lot, thank you very much! :slight_smile: