mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix: EEVEE: Undefined behavior in polygonal bokeh depth of field
This caused a discrepancy between Metal and other platforms. From the MSL specification: ``` atan2(y, x) Implemented as if x > 0, atan(y / x), if x < 0 and y > 0, atan(y / x) + M_PI_F if x < 0 and y < 0, atan(y / x) – M_PI_F and if x = 0 or y = 0, the result is undefined ``` Also the GLSL specification: ``` The result is undefined if x=0. ``` Fixed by adding a small epsilon to `atan`. Pull Request: https://projects.blender.org/blender/blender/pulls/159305
This commit is contained in:
parent
43595b142d
commit
6ce49cab38
2 changed files with 8 additions and 5 deletions
|
|
@ -55,7 +55,8 @@ void comp_main([[resource_table]] Resources &srt, [[global_invocation_id]] const
|
|||
{
|
||||
/* Slight focus distance */
|
||||
slight_focus_texel *= srt.dof_buf.bokeh_anisotropic_scale_inv;
|
||||
float theta = atan(slight_focus_texel.y, -slight_focus_texel.x) + M_TAU;
|
||||
/* Note that `atan(y,x)` is unsed for x = 0 or y = 0. */
|
||||
float theta = atan(slight_focus_texel.y + 1e-8f, -slight_focus_texel.x + 1e-8f) + M_TAU;
|
||||
slight_focus_texel /= circle_to_polygon_radius(srt.dof_buf.bokeh_blades,
|
||||
theta + srt.dof_buf.bokeh_rotation);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,12 @@ BLOCKLIST = [
|
|||
"transparent_shadow_limit_.*",
|
||||
# Redundant with transparent_shadow_hair.
|
||||
"transparent_shadow_hair_blur.blend",
|
||||
# Unsupported feature. Redundant tests.
|
||||
"osl_camera_.*",
|
||||
# Unsupported feature. Redundant tests. (except osl_camera_advanced which tests triangular bokeh)
|
||||
"osl_camera_advanced_manual_dof.blend",
|
||||
"osl_camera_advanced_manual_dof_138188.blend",
|
||||
"osl_camera_cubemap.blend",
|
||||
"osl_camera_cubemap_auto_derivatives.blend",
|
||||
"osl_camera_offset_in_volume.blend",
|
||||
# Extreme texture values interpolate differently on different GPUs.
|
||||
"image_log.blend",
|
||||
# Exhibit the LTC light leaking issue. To be enabeld back after fixing.
|
||||
|
|
@ -73,8 +77,6 @@ BLOCKLIST_METAL = [
|
|||
"environment_mirror_ball.blend",
|
||||
# Blocked due to difference in mipmap interpolation / anisotropic filtering (to be fixed).
|
||||
"image.blend",
|
||||
# Blocked due to subtle differences in DOF
|
||||
"osl_camera_advanced.blend",
|
||||
]
|
||||
|
||||
BLOCKLIST_VULKAN = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue