godotengine / godotengine/godot

GradientTexture2D repeat option is broken (differently in 4 vs 3)

Open
#87,592 2 comments 0 reactions 0 assignees View on GitHub
discussion topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### 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](https://github.com/godotengine/godot/files/14056514/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:

```
const MAT = preload("res://path/to/mat.tres")

func _ready():
MAT.albedo_texture.flags &= ~Texture.FLAG_REPEAT
MAT.albedo_texture.flags |= Texture.FLAG_REPEAT
```

Contributor guide

Open the contributing guide

Research direction

Start by running texture_flags_not_saved.zip in Godot 4.2.1 and 3.5.2, comparing the enabled and disabled GradientTexture2D repeat settings after reloading and running the projects. Trace how the editor saves the texture flag and how rendering applies it; done means repeat-enabled and repeat-disabled textures behave consistently and the setting persists in both supported versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.