Skip to content

Commit 1e9200d

Browse files
committed
Merge pull request godotengine#107099 from Kaleb-Reid/fix-sun-scatter
Increase directional light energy in sky for fog sun scatter
2 parents d37a113 + bac9427 commit 1e9200d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

drivers/gles3/rasterizer_scene_gles3.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,10 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
700700
sky_light_data.energy *= RSG::camera_attributes->camera_attributes_get_exposure_normalization_factor(p_render_data->camera_attributes);
701701
}
702702

703-
Color linear_col = light_storage->light_get_color(base);
704-
sky_light_data.color[0] = linear_col.r;
705-
sky_light_data.color[1] = linear_col.g;
706-
sky_light_data.color[2] = linear_col.b;
703+
Color srgb_col = light_storage->light_get_color(base);
704+
sky_light_data.color[0] = srgb_col.r;
705+
sky_light_data.color[1] = srgb_col.g;
706+
sky_light_data.color[2] = srgb_col.b;
707707

708708
sky_light_data.enabled = true;
709709

drivers/gles3/shaders/sky.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ vec4 fog_process(vec3 view, vec3 sky_color) {
141141
vec4 sun_scatter = vec4(0.0);
142142
float sun_total = 0.0;
143143
for (uint i = 0u; i < directional_light_count; i++) {
144-
vec3 light_color = directional_lights.data[i].color_size.xyz * directional_lights.data[i].direction_energy.w;
145-
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0);
144+
vec3 light_color = srgb_to_linear(directional_lights.data[i].color_size.xyz) * directional_lights.data[i].direction_energy.w;
145+
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0) * M_PI;
146146
fog_color += light_color * light_amount * fog_sun_scatter;
147147
}
148148
}

servers/rendering/renderer_rd/shaders/environment/sky.glsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ vec4 fog_process(vec3 view, vec3 sky_color) {
164164
float sun_total = 0.0;
165165
for (uint i = 0; i < sky_scene_data.directional_light_count; i++) {
166166
vec3 light_color = directional_lights.data[i].color_size.xyz * directional_lights.data[i].direction_energy.w;
167-
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0);
167+
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0) * M_PI;
168168
fog_color += light_color * light_amount * sky_scene_data.fog_sun_scatter;
169169
}
170170
}

0 commit comments

Comments
 (0)