Open jamie-pate opened 9 months ago
Taking a look at your MRP, it seems that you misunderstand what the repeat
property does (at least in Godot 4).
The repeat property controls how the texture is created not what happens to the texture once it is applied to a mesh.
Here is what the docs say about repeat:
The gradient repeat type, one of the Repeat values. The texture is filled starting from fill_from to fill_to offsets by default, but the gradient fill can be repeated to cover the entire texture.
As it explains, it will repeat a pattern across the texture specified by fill_from and fill_to. This creates a repeating pattern across the texture.
Adjusting your MRP to make fill_to
only go to 0.5 creates this:
This repeat disabled you can see how, instead of repeating, the gradient hits white and then stops:
In both cases the texture repeats across the surface of the mesh because you have scaled the UVs by 10 (thus making the texture repeat ten times across the surface:
If you don't want the texture to be sampled with the repeat mode, you need to disable repeat in the material:
This form of sampling is equivalent to the Texture.FLAG_REPEAT
flag in Godot 3.x. In Godot 4, sampling properties (like filter and repeat) are specified in the material and not on the texture.
I am primarily reporting about godot 3 anyways, but maybe it's just about the issue where godot 3 fails to save the texture repeat flag on textures in the material editor. it works if you set the flag after loading the texture.
Tested versions
Texture repeat has been broken for some time. Often in v3 clicking the 'repeat' flag in the editor does nothing. The system looks like it was overhauled in v4, the GradientTexture2D has a 'Repeat' option but it doesn't affect the way it's rendered. (v4 always repeats, v3 never repeats)
System information
Godot v4.2.1.stable - Ubuntu 20.04.6 LTS (Focal Fossa) - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Laptop GPU () - 12th Gen Intel(R) Core(TM) i7-12700H (14 Threads) and Godot 3.5.2.stable - Ubuntu 20.04.6 LTS (Focal Fossa) - GLES3 - dedicated NVIDIA GeForce RTX 3050 Laptop
Issue description
Using the repeat option in GradientTexture2D does not work.
In v4 the texture aways repeats In v3 the texture never repeats (unless you use a script to set the
repeat
flag)Steps to reproduce
Run the reproduction projects. One texture has repeat enabled, the other has it disabled, both repeat in v4 and neither repeats in v3
Setting the option in the editor may work sometimes, but never saves. (try reloading or running the project)
Minimal reproduction project (MRP)
texture_flags_not_saved.zip
Workaround
In v3 you can work around this issue by adding a script that sets the texture flag on the resource after it's loaded: