I have so far built a system that generates one or more static meshes. Their position and size (scale) can be defined.
My problem is that I need to manipulate the material so that it repeats the texture, not resize it but I cannot find a way in Blueprint to access the UV as an example.
I got so far that I created a dynamic material that can be changed at runtime but UVs are stored in a TexCoord, without a name to grab it
Create a new material, with a Texture2D, or a Texture2D Parameter, difference being a paramater can be changed outside of the material editor!
There is an input UV on the Texture2D with UV on it. You can connect this with a TexCoord, but this texcoord is not a parameter, so canât be changed outside of the materialâŚ
UVâs are values between 0 and 1. If itâs more than 1, it will repeat itself. So to make sure we can change it we need a so called Scalar Parameter. Give the scalar parameter a name to your liking, i.e. âUV Tilingâ. Now multiply this value with TexCoord. Now Connect the multiply with the UVâs from the Texture2D node. Compile/Save.
Now in the Content Browser you need to make an instance. Because we canât change a material directly, but we can change a material instance. Right click on the material and select âCreate Instanceâ. Give it a cool name and put it on the object.
If you go into the material instance you will see your Scalar Parameter âUV Tilingâ. You can change it by enabling it first with the toggle next. Change the value to see if it is actually tiling the way you want to.
Now you can change this parameter in Blueprint. Not really sure what the blueprint nodes are named exactly (currently not sitting behind my UE4 computer.). But if you look for material, or parameter you might find something you are looking for.
So remember: The object that you are changing should have the INSTANCE applied!
Side node: If you want different x and y tiling, you can append 2 Scalar Parameters together and multiply that with the TexCoord node.
+1
Roelâs technique is the optimal⌠You can also set TexCoordâs U and V values to 1, so that the final params equal your two scalars (as they are always multiplied by 1)âŚ