Created
October 18, 2020 16:30
-
-
Save cenullum/b16f87cded4ea3cf15871712c9f6b11a to your computer and use it in GitHub Desktop.
Godot Engine Circle with Outline Color Shader
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_type canvas_item; | |
uniform vec4 outline_color:hint_color = vec4(1.0,1.0,0.0,1.0); | |
uniform float inner_circle=0.45; | |
uniform float outer_circle=0.5; | |
const vec4 alpha_color= vec4(0,0,0,0); | |
uniform float smoothness=0.01; | |
void fragment(){ | |
vec2 origin = UV-vec2(0.5,0.5); | |
float dist =length(origin); //sqrt(dot(origin,origin)); | |
vec4 _color= mix (texture(TEXTURE,UV),outline_color,smoothstep(inner_circle-smoothness,inner_circle+smoothness,dist)); | |
COLOR= mix (_color,alpha_color,smoothstep(outer_circle-smoothness,outer_circle+smoothness,dist)); | |
} |
Author
cenullum
commented
Oct 18, 2020
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment