Created
February 13, 2020 14:25
-
-
Save andrew-wilkes/e73aff3972933c8fed3c9778d721654c to your computer and use it in GitHub Desktop.
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 spatial; | |
| uniform vec3 target = vec3(1.0, 0.0, 0.0); | |
| uniform float alpha = 1.0; | |
| uniform vec4 globe_color : hint_color = vec4(0.1, 0.5, 0.99, 0.5); | |
| uniform vec4 shield_color : hint_color = vec4(0.99, 0.0, 0.1, 1.0); | |
| varying float ang; | |
| void vertex() { | |
| vec3 v = vec3(VERTEX.xy, VERTEX.z); | |
| ang = dot(normalize(target), normalize(v)); | |
| } | |
| void fragment() { | |
| float lim = 0.9 + 0.099 * alpha * abs(sin(TIME * 40.0)); | |
| if (ang > lim) { | |
| ALBEDO = shield_color.rgb; | |
| ALPHA = alpha; | |
| EMISSION = shield_color.rgb * lim; | |
| } else { | |
| ALBEDO = globe_color.rgb; | |
| EMISSION = globe_color.rgb; | |
| ALPHA = alpha * globe_color.a; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment