Last active
February 3, 2024 22:13
-
-
Save redaphid/c79427e84badffc922cfe1eb6a21981f to your computer and use it in GitHub Desktop.
Demo of shaders that can run anywhere
This file contains 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
void mainImage(out vec4 color,in vec2 fragCoord){ | |
vec2 resolution=iResolution.xy; | |
// Adjusted coordinates to center the circle | |
vec2 uv=(vec2(fragCoord.x,resolution.y-fragCoord.y)/resolution.xy-.5)*2.; | |
float radius=iMouse.x/1000.; | |
#ifdef PAPER_CRANES | |
radius = energyNormalized; | |
#endif | |
// Calculate the distance from the center | |
float dist=length(uv); | |
// Determine if we're inside the circle | |
if(dist<radius){ | |
// Inside the circle | |
color=vec4(0.,0.,1.,1.); | |
return; | |
} | |
color=vec4(0.,0.,0.,0.);// Transparent | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment