Color hints on shaders. Fadeout notelines.

This commit is contained in:
Luke Hubmayer-Werner 2019-12-21 10:59:20 +10:30
parent c68d777daa
commit f11421195e
3 changed files with 15 additions and 12 deletions

View File

@ -19,9 +19,9 @@
[sub_resource type="ShaderMaterial" id=4]
shader = ExtResource( 4 )
shader_param/num_receptors = 8
shader_param/line_color = Plane( 0, 0, 1, 1 )
shader_param/dot_color = Plane( 0, 0, 1, 1 )
shader_param/shadow_color = Plane( 0, 0, 0, 1 )
shader_param/line_color = Color( 0, 0, 1, 1 )
shader_param/dot_color = Color( 0, 0, 1, 1 )
shader_param/shadow_color = Color( 0, 0, 0, 1 )
shader_param/line_thickness = 0.006
shader_param/dot_radius = 0.033
shader_param/shadow_thickness = 0.01
@ -39,6 +39,7 @@ shader_param/line_thickness_min = 0.0
shader_param/dot_thickness = 0.033
shader_param/dot_fullbright_thickness = 0.013
shader_param/max_angle = 1.0708
shader_param/max_dist = 1.25
[sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 9 )
@ -138,6 +139,3 @@ margin_bottom = 540.0
custom_fonts/font = ExtResource( 14 )
text = "Fingers on the screen:"
script = ExtResource( 15 )
__meta__ = {
"_edit_lock_": true
}

View File

@ -1,15 +1,16 @@
shader_type canvas_item;
render_mode blend_premul_alpha;
uniform vec4 line_color = vec4(0.8, 0.8, 1.0, 0.8);
uniform vec4 line_color_double = vec4(1.0, 1.0, 0.6, 0.9);
uniform vec4 dot_color = vec4(1.0, 1.0, 1.0, 0.8);
uniform vec4 line_color : hint_color = vec4(0.8, 0.8, 1.0, 0.8);
uniform vec4 line_color_double : hint_color = vec4(1.0, 1.0, 0.6, 0.9);
uniform vec4 dot_color : hint_color = vec4(1.0, 1.0, 1.0, 0.8);
uniform float bps = 1.0;
uniform float line_thickness = 0.012;
uniform float line_thickness_min = 0.0;
uniform float dot_thickness = 0.033;
uniform float dot_fullbright_thickness = 0.013;
uniform float max_angle = 1.0708; //3.14159*0.5; //radians(90.0);
uniform float max_dist = 1.25;
//void vertex() {
//}
@ -131,4 +132,8 @@ void fragment() {
COLOR.a = 0.0;
// COLOR.rgb = (line_color_double.rgb*line_double_alpha + line_color.rgb*line_alpha*(1.0-line_double_alpha))/(line_double_alpha + line_alpha*(1.0-line_double_alpha));
// COLOR.a = min(line_double_alpha + line_alpha*(1.0-line_double_alpha), 1.0);
if (dist > 1.0){
float fade = 1.0 - clamp((max_dist - dist)/(max_dist - 1.0), 0.0, 1.0);
COLOR.rgb = mix(COLOR.rgb, vec3(0.0), fade);
}
}

View File

@ -2,9 +2,9 @@ shader_type canvas_item;
render_mode blend_premul_alpha;
uniform int num_receptors = 8;
uniform vec4 line_color = vec4(0.0, 0.0, 1.0, 1.0);
uniform vec4 dot_color = vec4(0.0, 0.0, 1.0, 1.0);
uniform vec4 shadow_color = vec4(0.0, 0.0, 0.0, 1.0);
uniform vec4 line_color : hint_color = vec4(0.0, 0.0, 1.0, 1.0);
uniform vec4 dot_color : hint_color = vec4(0.0, 0.0, 1.0, 1.0);
uniform vec4 shadow_color : hint_color = vec4(0.0, 0.0, 0.0, 1.0);
//uniform float bps = 1.0;
uniform float line_thickness = 0.006;
uniform float dot_radius = 0.033;