Correcting small alpha issue for zabr/stigi superposition

This commit is contained in:
yannk 2022-04-15 19:00:27 +02:00
parent d4f27611b2
commit ab6678b079
2 changed files with 8 additions and 8 deletions

View file

@ -31,12 +31,12 @@ shader_param/sun_disk_scale = 1.0
shader_param/ground_color = Color(0.1, 0.07, 0.034, 1)
shader_param/exposure = 0.1
shader_param/dither_strength = 1.0
shader_param/samayun_arc = 50.0
shader_param/samayun_position = Vector3(2.038, 0.695, -0.296)
shader_param/zabr_arc = 15.0
shader_param/zabr_position = Vector3(1.755, 0.627, 0.768)
shader_param/samayun_arc = 45.681
shader_param/samayun_position = Vector3(2.038, 0.695, -0.237)
shader_param/zabr_arc = 8.0
shader_param/zabr_position = Vector3(1.755, 0.599, 0.613)
shader_param/stigi_arc = 8.381
shader_param/stigi_position = Vector3(0.925, 0.277, 0.17)
shader_param/stigi_position = Vector3(1.209, 0.444, 0.332)
shader_param/samayun = ExtResource( "1_thm7k" )
shader_param/zabr = ExtResource( "3_bgghj" )
shader_param/stigi = ExtResource( "3_jqgsm" )
@ -61,7 +61,7 @@ data = PackedVector3Array(-0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0
[node name="basic_setup" type="Node3D"]
[node name="sunlight" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.634731, 0.772734, 0, -0.772734, 0.634731, -1.75049, 15.9707, 4.39927)
transform = Transform3D(1, 0, 0, 0, 0.278991, 0.960294, 0, -0.960294, 0.278991, -1.75049, 15.9707, 4.39927)
light_color = Color(0.988235, 0.960784, 1, 1)
light_energy = 0.75
shadow_enabled = true

View file

@ -143,10 +143,10 @@ void sky() {
// Adding zabr
if (length(EYEDIR - normalize(zabr_position)) < zabr_scale / 2.0) { // we are in the area of the sky where zabr is placed
if (length(EYEDIR - normalize(samayun_position)) < samayun_scale / 2.0){ // if samayun is in front of zabr, dont draw where samayun alpha is > 0
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a), 0.0);
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(samayun, samayun_uv / samayun_scale + vec2(0.5)).a), 0.0) ;
} else {
if (length(EYEDIR - normalize(stigi_position)) < stigi_scale / 2.0){ // if stigi is in front of zabr, dont draw where its alpha is > 0
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * (texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a);
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * max((texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a - texture(stigi, stigi_uv / stigi_scale + vec2(0.5)).a), 0.0) ;
} else {
COLOR += texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).rgb * texture(zabr, zabr_uv / zabr_scale + vec2(0.5)).a;
}