Scaling and Altering Your Textures
When working with textures and materials within the Unreal Engine you can find a texture for your world of basically any shape, color, design or image you want. But sometimes the one texture that you find just isn’t scaled or squared off correctly to the object you are placing it on. Well there’s a simple way within the Unreal Editor on how to independently manipulate the horizontal and vertical sizes of your texture. Once you have a material created in your models with your desired texture, we will right click on it and select “Create Material Instance”. It will create a new instance in your models of this material, it will prompt you once created to rename it. Once created and renamed we will open it up and see the “Details” tab for it, it will look like this :
From this “Details” tab you can see that there is nothing in these settings that will allow me to adjust the scaling of the texture. We have to first create those parameters so that we can then alter them. To do this we will open up the original material itself that has our texture we want to use.
The long box is what is called the “Output Node” this is the result, what will it will look like in our world. The smaller box labeled “Texture Sample” is the texture that we have stored in the material that we want to use. In the “Texture Sample” box we have different things that can be plugged into it with other nodes. We want to use the “UVs” setting to add in our parameters. Lets create a new node names “TextureCoordinate” and connect it to the UVs of the “Texture Sample” box. This will allow us to scale the texture as you can see on the left side under the preview. The “UTiling” and “VTiling” can now be adjusted to make the bricks in the texture appear bigger or smaller.
This is great because now we can adjust and scale our texture to fit on to our meshes correctly the way we want them too. The only issue is that this only alters the main original texture and not individual instances of the texture that might have been used for other meshes within your world. To be able to independently change each instance we have to add a couple more nodes to the material. The first node that we will need to add is called the “ScalarParameter”. It will prompt a rename once created and we will name it “U Texture Scale” and set the default value of it under the “Details” tab to “1.0”. We will need to create another node that is identical to this one but name it “V Texture Scale”. The node itself could be copied and pasted for an easy copy and just be renamed. Once we have those other two nodes added we now need to join those nodes together with an “AppendVector” node. You would connect the “U Texture Scale” and the “V Texture Scale” nodes to this “AppendVector” node. The final step in the process is to have this newly “AppendVector” node multiplied by the “TextureCoordinate” node that we created earlier. Then plug that new multiplied node into the “UVs”. This will now allow us to change and scale the texture for individual instances. The final material page with all the nodes built and connected properly should look like this :
Now once your material has been built and setup this way if you go back to your “NewInstance” you will see that in the “Details” tab you will now have two extra settings for “U Texture Scale” and “V Texture Scale”. The default for both is set to “1.0” which is the default we set them at when we created the nodes for them. To alter them now you simply check the box and adjust the scale as you want, the bigger the number the smaller the texture scales, the lower the number the larger the texture scales.
Now you can alter individual instances within your world and can have them look like different textures all together without having to import a different texture. It also allows you to be able to scale the texture to fit any oddly shaped meshes that you might have the texture added to within your world.