Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-07-27 18:35:10 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-07-28 18:01:05 +0300
commit1e0aa2612c3f62607f1d12fd9d594cba96680f6c (patch)
tree086804c2186d8ba7593ea56d050bc3d1abc1f3e8 /source/blender/draw/intern/shaders
parent82327ce01de9be65b20c261977c9c3ccb59e0952 (diff)
EEVEE-Next: Motion Blur new implementation
The new implementation leverage compute shaders to reduce the number of passes and complexity. The max blur amount is now detected automatically, replacing the property in the render panel by a simple checkbox. The dilation algorithm has also been rewritten from scratch into a 1 pass algorithm that does the dilation more efficiently and more precisely. Some differences with the old implementation can be observed in areas with complex motion.
Diffstat (limited to 'source/blender/draw/intern/shaders')
-rw-r--r--source/blender/draw/intern/shaders/common_math_geom_lib.glsl24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/draw/intern/shaders/common_math_geom_lib.glsl b/source/blender/draw/intern/shaders/common_math_geom_lib.glsl
index ae82277d9a6..cb2da9d35bf 100644
--- a/source/blender/draw/intern/shaders/common_math_geom_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_math_geom_lib.glsl
@@ -10,6 +10,11 @@ float point_plane_projection_dist(vec3 line_origin, vec3 plane_origin, vec3 plan
return dot(plane_normal, plane_origin - line_origin);
}
+float point_line_projection_dist(vec2 point, vec2 line_origin, vec2 line_normal)
+{
+ return dot(line_normal, line_origin - point);
+}
+
float line_plane_intersect_dist(vec3 line_origin,
vec3 line_direction,
vec3 plane_origin,
@@ -104,6 +109,25 @@ float line_unit_box_intersect_dist_safe(vec3 line_origin, vec3 line_direction)
}
/**
+ * Same as line_unit_box_intersect_dist but for 2D case.
+ */
+float line_unit_square_intersect_dist(vec2 line_origin, vec2 line_direction)
+{
+ vec2 first_plane = (vec2(1.0) - line_origin) / line_direction;
+ vec2 second_plane = (vec2(-1.0) - line_origin) / line_direction;
+ vec2 farthest_plane = max(first_plane, second_plane);
+
+ return min_v2(farthest_plane);
+}
+
+float line_unit_square_intersect_dist_safe(vec2 line_origin, vec2 line_direction)
+{
+ vec2 safe_line_direction = max(vec2(1e-8), abs(line_direction)) *
+ select(vec2(1.0), -vec2(1.0), lessThan(line_direction, vec2(0.0)));
+ return line_unit_square_intersect_dist(line_origin, safe_line_direction);
+}
+
+/**
* Returns clipping distance (intersection with the nearest plane) with the given axis-aligned
* bound box along \a line_direction.
* Safe even if \a line_direction is degenerate.