Working thru “Godot 4 Shaders”, Common Techniques → Scrolling Background.
I don’t get why/how UV = UV * vec2(5.0, 5.0);
tiles 5-times ?
As I understands UV is (just) vec2, representing XY coordinates into a texture.
So by multiplying a UV by 5.0 would we not fall out of the texture?
Does the UV wrap (i.e. 1.1 == 0.1) by only using the fraction part of float?
The .gd script example of what I’m wondering about:
var vTile = Vector2(5.0, 5.0)
print( Vector2(0.0, 0.0) * vTile ) # (0.0, 0)
print( Vector2(0.1, 0.0) * vTile ) # (0.5, 0)
print( Vector2(0.11, 0.0) * vTile ) # (0.55, 0)
print( Vector2(0.12, 0.0) * vTile ) # (0.6, 0)
print( Vector2(0.2, 0.0) * vTile ) # (1.0, 0)
print( Vector2(0.3, 0.0) * vTile ) # (1.5, 0) -> (0.5, 0) ?
print( Vector2(0.8, 0.0) * vTile ) # (4.0, 0) -> (1.0, 0) ?
print( Vector2(0.9, 0.0) * vTile ) # (4.5, 0) -> (0.5, 0) ?
print( Vector2(1.0, 0.0) * vTile ) # (5.0, 0) -> (1.0, 0) ?
This would explain it, but can’t find any confirmation …