shader_type spatial;
render_mode blend_mul, cull_back, unshaded;

uniform vec4 shadowTopColor : source_color;
uniform vec4 shadowBottomColor: source_color;
uniform float opacity: hint_range(0, 5) = 1;
uniform float scaling: hint_range(0, 5) = 1;


void vertex()
{
  VERTEX += NORMAL * 0.001;
}

void fragment() 
{
  vec4 mixedColor = mix( shadowTopColor, shadowBottomColor, UV.y );
  
	
  float d = scaling * length ( UV - vec2( 0.5, 0.5 ) ) / length(  vec2( 0.5, 0.5 ));
	ALPHA *= min( 1.0, mixedColor.a * opacity * d * 0.7);
  ALBEDO = mix( mixedColor.rgb, vec3( 1 ), 1.0 - ALPHA );

}
