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
Any tips or help is really appreciated.
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.
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)…