shader_type canvas_item; render_mode blend_premul_alpha; const float TAU = 6.283185307; const float PI = 3.1415926536; const vec4 dbg_color = vec4(1.0, 0.0, 0.0, 1.0); uniform int num_receptors = 8; uniform float receptor_offset = 0.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, 0.57); //uniform float bps = 1.0; uniform float line_thickness = 0.006; uniform float dot_radius = 0.033; uniform float shadow_thickness = 0.01; uniform float px = 0.002; // Represents 1px in UV space, for AA purposes uniform float px2 = 0.004; // Represents 2px in UV space, for AA purposes uniform float alpha = 1.0; //void vertex() { //} float angle_diff(float a, float b) { float d = mod((a - b), TAU); if (d > PI) d = TAU - d; return d; } vec2 line_alpha(float dist) { // Returns [line, shadow] float d = abs(dist - 1.0) - line_thickness; return clamp(vec2(-1.0 - d/px, 1.0 - d/shadow_thickness), 0.0, 1.0); } vec2 dot_alpha(vec2 uv) { // Returns [dot, shadow] vec2 output = vec2(0.0); // Iterate over all the receptors and check distance to them float receptor_spacing = TAU/float(num_receptors); for (float rads=receptor_offset; rads