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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2020-08-03 04:28:04 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2020-08-03 04:44:40 +0300
commitb5dcf746369e51c08285292cd78f621999dd09e9 (patch)
tree1eec4e7e262b40711002002a13df94ed91015a92 /source/blender/blenloader
parent396d0b5cd0bcd9dd3dfa8d9006ee9f6f91c7196d (diff)
Cycles: add support for rendering deformation motion blur from Alembic caches.
This patch adds the ability to render motion blur from Alembic caches. The motion blur data is derived from a velocity attribute whose name has to be defined by the user through the MeshSequenceCache modifier, with a default value of ".velocities", which is the standard name in Alembic for the velocity property, although other software may ignore it and write velocity with their own naming convention (e.g. "v" in Houdini). Furthermore, a property was added to define how the velocity vectors are interpreted with regard to time : frame or second. "Frame" means that the velocity is already scaled by the time step and we do not need to modify it for it to look proper. "Second" means that the unit the velocity was measured in is in seconds and so has to be scaled by some time step computed here as being the time between two frames (1 / FPS, which would be typical for a simulation). This appears to be common, and is the default behavior. Another property was added to control the scale of the velocity to further modify the look of the motion blur. Reviewed By: brecht, sybren Differential Revision: https://developer.blender.org/D2388
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_290.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index b6caa018756..c4c697254bd 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -22,9 +22,11 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
+#include "DNA_cachefile_types.h"
#include "DNA_constraint_types.h"
#include "DNA_genfile.h"
#include "DNA_gpencil_modifier_types.h"
@@ -427,5 +429,28 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Initialise additional velocity parameter for CacheFiles. */
+ if (!DNA_struct_elem_find(
+ fd->filesdna, "MeshSeqCacheModifierData", "float", "velocity_scale")) {
+ for (Object *object = bmain->objects.first; object != NULL; object = object->id.next) {
+ LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
+ if (md->type == eModifierType_MeshSequenceCache) {
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
+ mcmd->velocity_scale = 1.0f;
+ mcmd->vertex_velocities = NULL;
+ mcmd->num_vertices = 0;
+ }
+ }
+ }
+ }
+
+ if (!DNA_struct_elem_find(fd->filesdna, "CacheFile", "char", "velocity_unit")) {
+ for (CacheFile *cache_file = bmain->cachefiles.first; cache_file != NULL;
+ cache_file = cache_file->id.next) {
+ BLI_strncpy(cache_file->velocity_name, ".velocities", sizeof(cache_file->velocity_name));
+ cache_file->velocity_unit = CACHEFILE_VELOCITY_UNIT_SECOND;
+ }
+ }
}
}