for me its dosnt work
can you help with this code
shader
shader_type canvas_item;
vec4 square(vec2 uv,float width,vec2 position){
uv = uv * 2.0 - 1.0;
vec2 abs_uv = abs(uv.xy + position);
float square = step(width,max(abs_uv.x, abs_uv.y));
return vec4(vec3(square),1.0);
}
void fragment() {
COLOR = vec4(square(UV,0.2, vec2(0.5,0.5)).r,square(UV,0.4,vec2(0.8,-0.8)).g,square(UV,0.4,vec2(-0.3,0.3)).b,1.0);
}
and the main code
extends Node2D
@onready var polygon_2d: Polygon2D = $Polygon2D
var polygon: Polygon2D
var packed_array: PackedVector2Array
var test_pos: float = 2.0
var shader_tex
var shader
func _ready() -> void:
create_polygon()
func create_polygon():
polygon = Polygon2D.new()
polygon.polygon = [
Vector2(100, 100),
Vector2(100,300 + test_pos),
Vector2(300,300 + test_pos),
Vector2(300,100),
]
shader_tex = preload("res://new.gdshader")
shader = ShaderMaterial.new()
shader.shader = shader_tex
var dummy_tex: Texture2D = preload("res://test/dummy_tex.png")
polygon.texture = dummy_tex
polygon.TEXTURE_REPEAT_ENABLED
polygon.material = shader
#polygon.uv = [
#Vector2(0, 0),
#Vector2(0,1),
#Vector2(1,1),
#Vector2(1,0),
#
#]
add_child(polygon)
func _process(delta: float) -> void:
if Input.is_action_pressed("action"):
test_pos += 200 * delta
polygon.polygon = [
Vector2(100, 100),
Vector2(100,300 + test_pos),
Vector2(300,300 + test_pos),
Vector2(300,100),
]
print("test", test_pos)
polygon.uv = [
Vector2(0, 0),
Vector2(0,1),
Vector2(1,1),
Vector2(1,0),
]

expected result where the pattern repeats
and in a column and the real result of the shader is stretched
how to make it not stretch but repeat
placed the polygon.uv into the process function but nothing changed