I'd like to be able to move my UVs over a bit in the shader. I tried doing this in the fragment shader: UV.x += 0.0161333333333; UV.y += 0.0226472; But Godot tells me constants cant be modified. I'm trying to create an effect that if a player pushes a button then the texture of an object changes, but I dont want to load a whole new texture so I figured I'd just move the UVs over a bit.
How to move the UVs over slightly?
Asked Answered
You need to use an intermediary variant since as the error warns you, you can't modify constants.
vec2 modified_uv = UV;
modified_uv.x += 0.0161333333333;
modified_uv.y += 0.0226472;
float color1 = texture(sometex, modified_uv);
ALBEDO = color1;
Something like that.
Thank you!
© 2022 - 2024 — McMap. All rights reserved.