Cycles: Added Cryptomatte output.
[blender.git] / intern / cycles / render / object.cpp
index e3f35c366d62109708f893f82794f8e3fd3b46c4..a56a8a6ec58e8a85691dd5837c068114cf922380 100644 (file)
@@ -28,6 +28,7 @@
 #include "util/util_map.h"
 #include "util/util_progress.h"
 #include "util/util_vector.h"
+#include "util/util_murmurhash.h"
 
 #include "subd/subd_patch_table.h"
 
@@ -483,6 +484,10 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
        kobject.numverts = mesh->verts.size();
        kobject.patch_map_offset = 0;
        kobject.attribute_map_offset = 0;
+       uint32_t hash_name = util_murmur_hash3(ob->name.c_str(), ob->name.length(), 0);
+       uint32_t hash_asset = util_murmur_hash3(ob->asset_name.c_str(), ob->asset_name.length(), 0);
+       kobject.cryptomatte_object = util_hash_to_float(hash_name);
+       kobject.cryptomatte_asset = util_hash_to_float(hash_asset);
 
        /* Object flag. */
        if(ob->use_holdout) {