Skip to content

Instantly share code, notes, and snippets.

@lucasvanmol
Last active November 7, 2020 17:13
Show Gist options
  • Select an option

  • Save lucasvanmol/eaae456879aeefaf242f90af688d2871 to your computer and use it in GitHub Desktop.

Select an option

Save lucasvanmol/eaae456879aeefaf242f90af688d2871 to your computer and use it in GitHub Desktop.
Simple shader to rotate UV space
shader_type canvas_item;
uniform float ANGLE = 0.0;
uniform vec2 CENTER = vec2(0.5);
uniform float TILING = 3.0;
void fragment() {
vec2 uv = (UV - CENTER)*TILING;
mat2 rot = mat2(
vec2( cos(ANGLE), -sin(ANGLE) ),
vec2( sin(ANGLE), cos(ANGLE)));
uv = rot * uv + CENTER;
COLOR = vec4(fract(uv), 0.0, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment