From af089bee98b2f06f07cc81351dd93c758795bef5 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 4 Jul 2024 17:12:04 +0200 Subject: [PATCH 1/5] Fix: Add missing Bake Channel operator to Dope Sheet This PR adds the operator "Bake Channels" to the "Channels" menu of the dope sheet. The operator was already in the "Channels" menu of the Graph Editor. Pull Request: https://projects.blender.org/blender/blender/pulls/123559 --- scripts/startup/bl_ui/space_dopesheet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/startup/bl_ui/space_dopesheet.py b/scripts/startup/bl_ui/space_dopesheet.py index 6d94fb81d9c..f9215f52c22 100644 --- a/scripts/startup/bl_ui/space_dopesheet.py +++ b/scripts/startup/bl_ui/space_dopesheet.py @@ -548,6 +548,9 @@ class DOPESHEET_MT_channel(Menu): layout.separator() layout.operator("anim.channels_fcurves_enable") + layout.separator() + layout.operator("anim.channels_bake") + layout.separator() layout.operator("anim.channels_view_selected") From 08d3c247c87be1aa97470874de3f090fd7eb7e4d Mon Sep 17 00:00:00 2001 From: Anthony Roberts Date: Thu, 4 Jul 2024 17:14:42 +0200 Subject: [PATCH 2/5] Windows: Disable TBB_MALLOC_PROXY on ARM64 Currently, every time blender starts on one of these platforms, we get the following warning (doesn't affect how it runs, all tests pass anyway): ``` TBBmalloc: skip allocation functions replacement in ucrtbase.dll: unknown prologue for function free ``` This is due to TBB_MALLOC_PROXY not working on these platforms (happens with emulated x64 too). I suspect it is fixed in the newer oneTBB releases that have proper support for Windows on Arm, rather than the patch I made to enable 2020u3. This can be revisited once the TBB version is updated. Pull Request: https://projects.blender.org/blender/blender/pulls/124148 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81b6ef5f954..6e96d15aaa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -794,7 +794,7 @@ Enable multi-threading. TBB is also required for features such as Cycles, OpenVD ) # TBB malloc is only supported on for windows currently -if(WIN32) +if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") option(WITH_TBB_MALLOC_PROXY "Enable the TBB malloc replacement" ON) endif() From a023499d288fbdf47a310062f519b3b6db17756f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 4 Jul 2024 19:32:40 +0200 Subject: [PATCH 3/5] Fix: EEVEE: Make shadow tracing more robust This commit does multiple things: - It checks `is_behind_occluder` in all non-extrapolated cases. This avoid false positive hit caused by tracing basis X axis being almost parallel to the light. - It checks time only on the last sample. This avoid light leaking when the ray poke through some solid objects because of raymarching steps. - Add bias to `is_behind_occluder` to avoid precision issues when ray is parallel to the light direction. This reduces noisy area lights but there are still issue very close to them. Fixes #123588 --- .../shaders/eevee_shadow_tracing_lib.glsl | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl index 1de716a7b56..2875b0b89b4 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl @@ -73,7 +73,7 @@ struct ShadowTracingSample { \ ShadowTracingSample samp = shadow_map_trace_sample(state, ray); \ \ - shadow_map_trace_hit_check(state, samp); \ + shadow_map_trace_hit_check(state, samp, i == sample_count); \ } \ return state.hit; \ } @@ -84,25 +84,22 @@ struct ShadowTracingSample { * This reverse tracing allows to approximate the geometry behind occluders while minimizing * light-leaks. */ -void shadow_map_trace_hit_check(inout ShadowMapTracingState state, ShadowTracingSample samp) +void shadow_map_trace_hit_check(inout ShadowMapTracingState state, + ShadowTracingSample samp, + bool is_last_sample) { - /* Skip empty tiles since they do not contain actual depth information. - * Not doing so would change the z gradient history. */ - if (samp.skip_sample) { - return; - } - /* For the first sample, regular depth compare since we do not have history values. */ - if (state.occluder_history.x == SHADOW_TRACING_INVALID_HISTORY) { - if (samp.occluder.x > state.ray_time) { - state.hit = true; - return; - } - state.occluder_history = samp.occluder; - return; - } + bool is_behind_occluder = samp.occluder.y > 1e-6; - bool is_behind_occluder = samp.occluder.y > 0.0; - if (is_behind_occluder && (state.occluder_slope != SHADOW_TRACING_INVALID_HISTORY)) { + if (samp.skip_sample) { + /* Skip empty tiles since they do not contain actual depth information. + * Not doing so would change the z gradient history. */ + } + else if (state.occluder_history.x == SHADOW_TRACING_INVALID_HISTORY) { + /* First sample, regular depth compare since we do not have history values. */ + state.hit = is_behind_occluder || (is_last_sample && (samp.occluder.x > state.ray_time)); + state.occluder_history = samp.occluder; + } + else if (is_behind_occluder && (state.occluder_slope != SHADOW_TRACING_INVALID_HISTORY)) { /* Extrapolate last known valid occluder and check if it crossed the ray. * Note that we only want to check if the extrapolated occluder is above the ray at a certain * time value, we don't actually care about the correct value. So we replace the complex @@ -111,6 +108,8 @@ void shadow_map_trace_hit_check(inout ShadowMapTracingState state, ShadowTracing float delta_time = state.ray_time - state.occluder_history.x; float extrapolated_occluder_y = abs(state.occluder_history.y) + state.occluder_slope * delta_time; + /* NOTE: We use the absolute of the function to account for all occluders configurations. + * The test just checks if it doesn't extrapolate in the other Y region. */ state.hit = extrapolated_occluder_y < 0.0; } else { @@ -122,7 +121,7 @@ void shadow_map_trace_hit_check(inout ShadowMapTracingState state, ShadowTracing state.occluder_slope = max(min_slope, abs(delta.y / delta.x)); state.occluder_history = samp.occluder; /* Intersection test. Intersect if above the ray time. */ - state.hit = samp.occluder.x > state.ray_time; + state.hit = is_behind_occluder || (is_last_sample && (samp.occluder.x > state.ray_time)); } } From 2149a0b2ccf79b46c455096e2e288dd61fd59679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 4 Jul 2024 19:47:47 +0200 Subject: [PATCH 4/5] EEVEE: Change local light ray clipping method The previous one was too conservative and didn't work with area light. --- .../eevee_next/shaders/eevee_shadow_tracing_lib.glsl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl index 2875b0b89b4..4305507d1e1 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl @@ -265,12 +265,13 @@ ShadowRayPunctual shadow_ray_generate_punctual(LightData light, vec2 random_2d, direction = point_on_light_shape - lP; direction = shadow_ray_above_horizon_ensure(direction, lNg, shape_radius); } + vec3 shadow_position = light_local_data_get(light).shadow_position; /* Clip the ray to not cross the near plane. * Avoid traces that starts on tiles that have not been queried, creating noise. */ - float clip_distance = clip_near + shape_radius * 0.5; - direction *= saturate(1.0 - clip_distance * inversesqrt(length_squared(direction))); + float clip_distance = length(lP - shadow_position) - clip_near; + /* Still clamp to a minimal size to avoid isssue with zero length vectors. */ + direction *= saturate(1e-6 + clip_distance * inversesqrt(length_squared(direction))); - vec3 shadow_position = light_local_data_get(light).shadow_position; /* Compute the ray again. */ ShadowRayPunctual ray; /* Transform to shadow local space. */ From 26ea1f42c34c80830aafaf395c8c43f0df6e69cb Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Thu, 4 Jul 2024 20:18:06 +0200 Subject: [PATCH 5/5] Fix #122808: Use Default Font when Vfont Missing For text objects, current code will use another font if you ask for a character that is not found in the selected font. But what if the selected font is invalid? This can happen with a saved Blend that uses a non-packed font that is since deleted. Current behavior will show nothing. This PR restores earlier behavior where we use the built-in font in this case. This does not make any changes to error reporting. Pull Request: https://projects.blender.org/blender/blender/pulls/124184 --- source/blender/blenkernel/intern/vfontdata_freetype.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/vfontdata_freetype.cc b/source/blender/blenkernel/intern/vfontdata_freetype.cc index 0f83986a078..6cfa1ebc212 100644 --- a/source/blender/blenkernel/intern/vfontdata_freetype.cc +++ b/source/blender/blenkernel/intern/vfontdata_freetype.cc @@ -93,7 +93,10 @@ VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, ulong character) } if (font_id == -1) { - return nullptr; + /* This could happen for a saved file with an unpacked local font that was + * later removed. Load the default UI font so we can still show _something_. */ + font_id = BLF_load_mem( + vfont->data->name, static_cast(builtin_font_data), builtin_font_size); } VChar *che = (VChar *)MEM_callocN(sizeof(VChar), "objfnt_char");