Last active
May 22, 2021 12:29
-
-
Save behreajj/c742a9a0b10bedbc640efa3fd36755ba to your computer and use it in GitHub Desktop.
Circle 0
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
shader circle0( | |
vector UV = vector(0.5, 0.5, 0.0), | |
vector Center = vector(0.5, 0.5, 0.0), | |
float Radius = 1.0, | |
float Blur = 0.0, | |
color Outside = color(1.0, 0.0, 0.0), | |
color Inside = 1.0, | |
output color Color = 0.8, | |
output float Fac = 0.5) { | |
vector diff = Center - UV; | |
float lenSq = dot(diff, diff); | |
float eval = 0.25 * Radius * Radius - lenSq; | |
float halfBlur = 0.5 * clamp(Blur, 0.0, 1.0); | |
Fac = smoothstep(-halfBlur, halfBlur, eval); | |
Color = mix(Outside, Inside, Fac); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment