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>2020-08-12 14:52:56 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-12 19:06:36 +0300
commit2b042d885af1f34be7c223d0aeab6cd3589ad41f (patch)
tree6910461001852c8328a60a700bc58a68ee02b238 /source/blender/draw/engines/eevee/eevee_data.c
parentcfbea0e09de31bf325ecaa86d8dcf22dc9903634 (diff)
EEVEE: Motion Blur: Use evaluated object as key to motion data
This fix issues with instanced geometry and modifiers. Since the depsgraph will duplicate the objects when they have different modifiers, the evaluated object are garanteed to be unique.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_data.c')
-rw-r--r--source/blender/draw/engines/eevee/eevee_data.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c
index c475e5287c2..b7db6fef918 100644
--- a/source/blender/draw/engines/eevee/eevee_data.c
+++ b/source/blender/draw/engines/eevee/eevee_data.c
@@ -149,12 +149,20 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *
}
static EEVEE_GeometryMotionData *motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb,
- void *key,
+ Object *ob,
bool hair)
{
if (mb->geom == NULL) {
return NULL;
}
+ DupliObject *dup = DRW_object_get_dupli(ob);
+ void *key;
+ if (dup) {
+ key = dup->ob;
+ }
+ else {
+ key = ob->data;
+ }
key = (char *)key + (int)hair;
EEVEE_GeometryMotionData *geom_step = BLI_ghash_lookup(mb->geom, key);
if (geom_step == NULL) {
@@ -167,25 +175,12 @@ static EEVEE_GeometryMotionData *motion_blur_geometry_data_get(EEVEE_MotionBlurD
EEVEE_GeometryMotionData *EEVEE_motion_blur_geometry_data_get(EEVEE_MotionBlurData *mb, Object *ob)
{
- /* Use original data as key to ensure matching accross update. */
- return motion_blur_geometry_data_get(mb, DEG_get_original_object(ob)->data, false);
+ return motion_blur_geometry_data_get(mb, ob, false);
}
-EEVEE_GeometryMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb,
- Object *ob,
- ModifierData *md)
+EEVEE_GeometryMotionData *EEVEE_motion_blur_hair_data_get(EEVEE_MotionBlurData *mb, Object *ob)
{
- void *key;
- if (md) {
- /* Particle system. */
- key = BKE_modifier_get_original(md);
- }
- else {
- /* Hair object. */
- key = DEG_get_original_object(ob)->data;
- }
-
- return motion_blur_geometry_data_get(mb, key, true);
+ return motion_blur_geometry_data_get(mb, ob, true);
}
/* View Layer data. */