1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix sky energy in fog sun scatter + colour space discrepancy in compatibility

This commit is contained in:
Kaleb Reid
2025-06-03 13:51:41 -07:00
parent e45cc68092
commit bac9427325
3 changed files with 7 additions and 7 deletions

View File

@@ -700,10 +700,10 @@ void RasterizerSceneGLES3::_setup_sky(const RenderDataGLES3 *p_render_data, cons
sky_light_data.energy *= RSG::camera_attributes->camera_attributes_get_exposure_normalization_factor(p_render_data->camera_attributes);
}
Color linear_col = light_storage->light_get_color(base);
sky_light_data.color[0] = linear_col.r;
sky_light_data.color[1] = linear_col.g;
sky_light_data.color[2] = linear_col.b;
Color srgb_col = light_storage->light_get_color(base);
sky_light_data.color[0] = srgb_col.r;
sky_light_data.color[1] = srgb_col.g;
sky_light_data.color[2] = srgb_col.b;
sky_light_data.enabled = true;

View File

@@ -141,8 +141,8 @@ vec4 fog_process(vec3 view, vec3 sky_color) {
vec4 sun_scatter = vec4(0.0);
float sun_total = 0.0;
for (uint i = 0u; i < directional_light_count; i++) {
vec3 light_color = directional_lights.data[i].color_size.xyz * directional_lights.data[i].direction_energy.w;
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0);
vec3 light_color = srgb_to_linear(directional_lights.data[i].color_size.xyz) * directional_lights.data[i].direction_energy.w;
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0) * M_PI;
fog_color += light_color * light_amount * fog_sun_scatter;
}
}

View File

@@ -164,7 +164,7 @@ vec4 fog_process(vec3 view, vec3 sky_color) {
float sun_total = 0.0;
for (uint i = 0; i < sky_scene_data.directional_light_count; i++) {
vec3 light_color = directional_lights.data[i].color_size.xyz * directional_lights.data[i].direction_energy.w;
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0);
float light_amount = pow(max(dot(view, directional_lights.data[i].direction_energy.xyz), 0.0), 8.0) * M_PI;
fog_color += light_color * light_amount * sky_scene_data.fog_sun_scatter;
}
}