[Bf-blender-cvs] [0213d9f8656] eevee-motionblur-object: EEVEE: Object Motion Blur: Initial Implementation

Clément Foucault noreply at git.blender.org
Tue Apr 14 19:09:13 CEST 2020


Commit: 0213d9f8656addee133cce2ae59a4666b4215236
Author: Clément Foucault
Date:   Wed Apr 1 01:50:59 2020 +0200
Branches: eevee-motionblur-object
https://developer.blender.org/rB0213d9f8656addee133cce2ae59a4666b4215236

EEVEE: Object Motion Blur: Initial Implementation

This adds object motion blur vectors for EEVEE as well as better noise reduction for it.

For TAA reprojection we just compute the motion vector on the fly based on camera motion and depth buffer.
This makes possible to store another motion vector only for the blurring which is not useful for TAA history
fetching.

The changes are quite simple. We just do an extra pass to write the motion vectors for opaque objects and
use the motion vector to do the motion blur sampling.

This does not improve the postprocess motion blur itself.

Viewport support is kind of a hack, relying on cached previously drawn objects states, and is to be enabled
through experimental support panel in userpref.

Differential Revision: https://developer.blender.org/D7297

===================================================================

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/draw/engines/eevee/eevee_motion_blur.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 165761254d0..6d3f915d96c 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -2187,6 +2187,17 @@ class USERPREF_PT_experimental_system(ExperimentalPanel, Panel):
         )
 
 
+class USERPREF_PT_experimental_eevee(ExperimentalPanel, Panel):
+    bl_label = "EEVEE"
+
+    def draw(self, context):
+        self._draw_items(
+            context, (
+                ({"property": "use_viewport_motion_blur"}, "T68464"),
+            ),
+        )
+
+
 # -----------------------------------------------------------------------------
 # Class Registration
 
@@ -2279,6 +2290,7 @@ classes = (
 
     USERPREF_PT_experimental_ui,
     USERPREF_PT_experimental_system,
+    USERPREF_PT_experimental_eevee,
 
     # Add dynamically generated editor theme panels last,
     # so they show up last in the theme section.
diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c
index ca271fd7042..982ca3a2e06 100644
--- a/source/blender/draw/engines/eevee/eevee_motion_blur.c
+++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c
@@ -94,6 +94,11 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
   const DRWContextState *draw_ctx = DRW_context_state_get();
   Scene *scene = draw_ctx->scene;
 
+  /* Viewport support is experimental. */
+  if (!DRW_state_is_scene_render() && !U.experimental.use_viewport_motion_blur) {
+    return 0;
+  }
+
   if (scene->eevee.flag & SCE_EEVEE_MOTION_BLUR_ENABLED) {
     float ctime = DEG_get_ctime(draw_ctx->depsgraph);
 
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 54470dc59fc..f1bb9bf7d7a 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -620,8 +620,9 @@ typedef struct UserDef_FileSpaceData {
 typedef struct UserDef_Experimental {
   char use_undo_speedup;
   char use_menu_search;
+  char use_viewport_motion_blur;
   /** `makesdna` does not allow empty structs. */
-  char _pad0[6];
+  char _pad0[5];
 } UserDef_Experimental;
 
 #define USER_EXPERIMENTAL_TEST(userdef, member) \
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 3b2753518bb..e3042541d3e 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6060,6 +6060,13 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
   prop = RNA_def_property(srna, "use_menu_search", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_menu_search", 1);
   RNA_def_property_ui_text(prop, "Menu Search", "Search actions by menus instead of operators");
+
+  prop = RNA_def_property(srna, "use_viewport_motion_blur", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "use_viewport_motion_blur", 1);
+  RNA_def_property_ui_text(
+      prop,
+      "Viewport Motion Blur",
+      "Activate partial support of viewport motion blur relying on last previously drawn frame");
 }
 
 static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)



More information about the Bf-blender-cvs mailing list