File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
servers/rendering/renderer_rd/shaders Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ void main() {
281281
282282 if (sky_scene_data.volumetric_fog_enabled) {
283283 vec4 fog = volumetric_fog_process(uv);
284- frag_color.rgb = mix ( frag_color.rgb, fog.rgb, fog.a * sky_scene_data.volumetric_fog_sky_affect);
284+ frag_color.rgb = frag_color.rgb * ( 1.0 - fog.a * sky_scene_data.volumetric_fog_sky_affect) + fog.rgb * sky_scene_data.volumetric_fog_sky_affect ;
285285 }
286286
287287 if (custom_fog.a > 0.0 ) {
Original file line number Diff line number Diff line change @@ -1443,20 +1443,21 @@ void fragment_shader(in SceneData scene_data) {
14431443#else
14441444 vec4 volumetric_fog = volumetric_fog_process(screen_uv, - vertex.z);
14451445#endif
1446+ vec4 res = vec4 (0.0 );
14461447 if (bool (scene_data.flags & SCENE_DATA_FLAGS_USE_FOG)) {
14471448 // must use the full blending equation here to blend fogs
1448- vec4 res;
14491449 float sa = 1.0 - volumetric_fog.a;
14501450 res.a = fog.a * sa + volumetric_fog.a;
1451- if (res.a == 0.0 ) {
1452- res.rgb = vec3 (0.0 );
1453- } else {
1454- res.rgb = (fog.rgb * fog.a * sa + volumetric_fog.rgb * volumetric_fog.a) / res.a;
1451+ if (res.a > 0.0 ) {
1452+ res.rgb = (fog.rgb * fog.a * sa + volumetric_fog.rgb) / res.a;
14551453 }
1456- fog = res;
14571454 } else {
1458- fog = volumetric_fog;
1455+ res.a = volumetric_fog.a;
1456+ if (res.a > 0.0 ) {
1457+ res.rgb = volumetric_fog.rgb / res.a;
1458+ }
14591459 }
1460+ fog = res;
14601461 }
14611462#endif // !CUSTOM_FOG_USED
14621463
You can’t perform that action at this time.
0 commit comments