diff --git a/scene/resources/3d/sky_material.cpp b/scene/resources/3d/sky_material.cpp index a2f9c0e54438..8e8b44e66e70 100644 --- a/scene/resources/3d/sky_material.cpp +++ b/scene/resources/3d/sky_material.cpp @@ -327,10 +327,10 @@ void sky() { float sun_angle = dot(LIGHT0_DIRECTION, EYEDIR); float sun_size = cos(LIGHT0_SIZE); if (sun_angle > sun_size) { - sky = LIGHT0_COLOR * LIGHT0_ENERGY; + sky += LIGHT0_COLOR * LIGHT0_ENERGY; } else if (sun_angle > sun_angle_max) { float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max); - sky = mix(sky, LIGHT0_COLOR * LIGHT0_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0)); + sky += LIGHT0_COLOR * LIGHT0_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0); } } @@ -338,10 +338,10 @@ void sky() { float sun_angle = dot(LIGHT1_DIRECTION, EYEDIR); float sun_size = cos(LIGHT1_SIZE); if (sun_angle > sun_size) { - sky = LIGHT1_COLOR * LIGHT1_ENERGY; + sky += LIGHT1_COLOR * LIGHT1_ENERGY; } else if (sun_angle > sun_angle_max) { float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max); - sky = mix(sky, LIGHT1_COLOR * LIGHT1_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0)); + sky += LIGHT1_COLOR * LIGHT1_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0); } } @@ -349,10 +349,10 @@ void sky() { float sun_angle = dot(LIGHT2_DIRECTION, EYEDIR); float sun_size = cos(LIGHT2_SIZE); if (sun_angle > sun_size) { - sky = LIGHT2_COLOR * LIGHT2_ENERGY; + sky += LIGHT2_COLOR * LIGHT2_ENERGY; } else if (sun_angle > sun_angle_max) { float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max); - sky = mix(sky, LIGHT2_COLOR * LIGHT2_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0)); + sky += LIGHT2_COLOR * LIGHT2_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0); } } @@ -360,10 +360,10 @@ void sky() { float sun_angle = dot(LIGHT3_DIRECTION, EYEDIR); float sun_size = cos(LIGHT3_SIZE); if (sun_angle > sun_size) { - sky = LIGHT3_COLOR * LIGHT3_ENERGY; + sky += LIGHT3_COLOR * LIGHT3_ENERGY; } else if (sun_angle > sun_angle_max) { float c2 = (sun_size - sun_angle) / (sun_size - sun_angle_max); - sky = mix(sky, LIGHT3_COLOR * LIGHT3_ENERGY, clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0)); + sky += LIGHT3_COLOR * LIGHT3_ENERGY * clamp(pow(1.0 - c2, inv_sun_curve), 0.0, 1.0); } }