Skip to content

Instantly share code, notes, and snippets.

@otanodesignco
Created October 1, 2024 04:17
Show Gist options
  • Save otanodesignco/d9fdae0d12c0a713dd41c85e2794deef to your computer and use it in GitHub Desktop.
Save otanodesignco/d9fdae0d12c0a713dd41c85e2794deef to your computer and use it in GitHub Desktop.
Twirl function for glsl ported from unity shader graph node
vec2 twirl( vec2 uv, vec2 center, float strength, vec2 offset )
{
vec2 delta = uv - center;
float angle = strength * length(delta);
float x = cos(angle) * delta.x - sin(angle) * delta.y;
float y = sin(angle) * delta.x + cos(angle) * delta.y;
return vec2(x + center.x + offset.x, y + center.y + offset.y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment