mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #96771 from clayjohn/RD-static-lighting
Avoid calculating dynamic lights when lights are already baked using the static bake mode in the Forward+ renderer
This commit is contained in:
commit
a167afd70a
6 changed files with 40 additions and 28 deletions
|
|
@ -2211,6 +2211,10 @@ void fragment_shader(in SceneData scene_data) {
|
|||
continue; //not masked
|
||||
}
|
||||
|
||||
if (directional_lights.data[i].bake_mode == LIGHT_BAKE_STATIC && bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) {
|
||||
continue; // Statically baked light and object uses lightmap, skip
|
||||
}
|
||||
|
||||
#ifdef LIGHT_TRANSMITTANCE_USED
|
||||
float transmittance_z = transmittance_depth;
|
||||
#ifndef SHADOWS_DISABLED
|
||||
|
|
|
|||
|
|
@ -1445,6 +1445,10 @@ void main() {
|
|||
continue; //not masked
|
||||
}
|
||||
|
||||
if (directional_lights.data[i].bake_mode == LIGHT_BAKE_STATIC && bool(instances.data[draw_call.instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) {
|
||||
continue; // Statically baked light and object uses lightmap, skip.
|
||||
}
|
||||
|
||||
float shadow = 1.0;
|
||||
|
||||
if (directional_lights.data[i].shadow_opacity > 0.001) {
|
||||
|
|
@ -1560,6 +1564,10 @@ void main() {
|
|||
continue; //not masked
|
||||
}
|
||||
|
||||
if (directional_lights.data[i].bake_mode == LIGHT_BAKE_STATIC && bool(instances.data[draw_call.instance_index].flags & INSTANCE_FLAGS_USE_LIGHTMAP)) {
|
||||
continue; // Statically baked light and object uses lightmap, skip.
|
||||
}
|
||||
|
||||
// We're not doing light transmittence
|
||||
|
||||
float shadow = 1.0;
|
||||
|
|
|
|||
|
|
@ -676,12 +676,13 @@ void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const Paged
|
|||
angular_diameter = 0.0;
|
||||
}
|
||||
|
||||
light_data.bake_mode = light->bake_mode;
|
||||
|
||||
if (light_data.shadow_opacity > 0.001) {
|
||||
RS::LightDirectionalShadowMode smode = light->directional_shadow_mode;
|
||||
|
||||
light_data.soft_shadow_scale = light->param[RS::LIGHT_PARAM_SHADOW_BLUR];
|
||||
light_data.softshadow_angle = angular_diameter;
|
||||
light_data.bake_mode = light->bake_mode;
|
||||
|
||||
if (angular_diameter <= 0.0) {
|
||||
light_data.soft_shadow_scale *= RendererSceneRenderRD::get_singleton()->directional_shadow_quality_radius_get(); // Only use quality radius for PCF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue