Created
April 24, 2022 08:37
-
-
Save supahfunk/46ad870a6cad032e9afd5fbc9d5d3a3b to your computer and use it in GitHub Desktop.
Twirl glsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform sampler2D textureMap; //image | |
uniform float amount; //amount of twirl | |
void main() { | |
vec2 uv = gl_TexCoord[0].st-0.5; | |
float angle = atan2(uv.y,uv.x); | |
float radius = length(uv); | |
angle+= radius*amount; | |
vec2 shifted = radius*vec2(cos(angle), sin(angle)); | |
gl_FragColor = texture(textureMap, (shifted+0.5)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment