diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-05-11 02:22:28 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-05-12 13:45:56 +0300 |
commit | f5077e057b01e3c19dd9ba00e3acee8138569ac9 (patch) | |
tree | 915a38988a2095b498c75f147d451b01e63d5c90 /source/blender/draw/engines/eevee/eevee_data.c | |
parent | 6f5d172d6cb1f91106cb2d918c4605da69269a40 (diff) |
Fix T97380 EEVEE: Weird motion-blur on curves
This was caused by the `mb_data->obmat[]` being wrong because they are
now shared between the particle system and the object.
But Hair need the dupli parent matrix instead of the object matrix.
Disabling `Show Emitter` option fixes the bug.
To avoid this problem, request a different `EEVEE_ObjectMotionData`
for particle systems using a different key pointer in the hash.
This is a bit dirty but there is less code polution using this workaround.
Differential Revision: https://developer.blender.org/D14911
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_data.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_data.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c index 0c56b67ca99..1a1e3b80bad 100644 --- a/source/blender/draw/engines/eevee/eevee_data.c +++ b/source/blender/draw/engines/eevee/eevee_data.c @@ -114,7 +114,9 @@ void EEVEE_motion_blur_data_free(EEVEE_MotionBlurData *mb) } } -EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *mb, Object *ob) +EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData *mb, + Object *ob, + bool is_psys) { if (mb->object == NULL) { return NULL; @@ -123,14 +125,16 @@ EEVEE_ObjectMotionData *EEVEE_motion_blur_object_data_get(EEVEE_MotionBlurData * EEVEE_ObjectKey key, *key_p; /* Assumes that all instances have the same object pointer. This is currently the case because * instance objects are temporary objects on the stack. */ - key.ob = ob; + /* WORKAROUND: Duplicate object key for particle system (hairs) to be able to store dupli offset + * matrix along with the emitter obmat. (see T97380) */ + key.ob = (void *)((char *)ob + is_psys); DupliObject *dup = DRW_object_get_dupli(ob); if (dup) { key.parent = DRW_object_get_dupli_parent(ob); memcpy(key.id, dup->persistent_id, sizeof(key.id)); } else { - key.parent = key.ob; + key.parent = ob; memset(key.id, 0, sizeof(key.id)); } |