diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-09-07 14:56:13 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-11 12:01:21 +0100 |
commit | 69e83e4815545e485350505668a4b9b83346f5bc (patch) | |
tree | 8a0bf7ed29e4a6bf1d72e9a0b95d5666cf2bcc37 | |
parent | 88a7debbbc2cd035932facc04b7740fc204bcca6 (diff) |
Directional light cleanup.
-rw-r--r-- | servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp | 6 | ||||
-rw-r--r-- | servers/visual/rasterizer_rd/shaders/scene_forward.glsl | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp index 11a3d62cab..e1aec58b96 100644 --- a/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_scene_forward_rd.cpp @@ -1432,7 +1432,7 @@ void RasterizerSceneForwardRD::_setup_lights(RID *p_light_cull_result, int p_lig } float fade_start = storage->light_get_param(base, VS::LIGHT_PARAM_SHADOW_FADE_START); - light_data.fade_from = -light_data.shadow_split_offsets[3] * MIN(fade_start, 0.999); + light_data.fade_from = -light_data.shadow_split_offsets[3] * MIN(fade_start, 0.999); //using 1.0 would break smoothstep light_data.fade_to = -light_data.shadow_split_offsets[3]; } @@ -2161,7 +2161,7 @@ void RasterizerSceneForwardRD::_render_scene(RenderBufferData *p_buffer_data, co } } - if (true) { + if (false) { if (directional_shadow_get_texture().is_valid()) { RID shadow_atlas_texture = directional_shadow_get_texture(); Size2 rtsize = storage->render_target_get_size(render_buffer->render_target); @@ -2462,7 +2462,7 @@ RasterizerSceneForwardRD::RasterizerSceneForwardRD(RasterizerStorageRD *p_storag scene_state.light_buffer = RD::get_singleton()->uniform_buffer_create(light_buffer_size); defines += "\n#define MAX_LIGHT_DATA_STRUCTS " + itos(scene_state.max_lights) + "\n"; - scene_state.max_directional_lights = 4; + scene_state.max_directional_lights = 8; uint32_t directional_light_buffer_size = scene_state.max_directional_lights * sizeof(DirectionalLightData); scene_state.directional_lights = memnew_arr(DirectionalLightData, scene_state.max_directional_lights); scene_state.directional_light_buffer = RD::get_singleton()->uniform_buffer_create(directional_light_buffer_size); diff --git a/servers/visual/rasterizer_rd/shaders/scene_forward.glsl b/servers/visual/rasterizer_rd/shaders/scene_forward.glsl index 37919566a5..1bed9f9672 100644 --- a/servers/visual/rasterizer_rd/shaders/scene_forward.glsl +++ b/servers/visual/rasterizer_rd/shaders/scene_forward.glsl @@ -1190,7 +1190,7 @@ FRAGMENT_SHADER_CODE shadow = mix(shadow,1.0,smoothstep(directional_lights.data[i].fade_from,directional_lights.data[i].fade_to,vertex.z)); //done with negative values for performance - light_attenuation = vec3(shadow); //mix(directional_lights.data[i].shadow_color, vec3(1.0), shadow); + light_attenuation = mix(directional_lights.data[i].shadow_color, vec3(1.0), shadow); } |