diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-11-26 23:34:29 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2013-11-26 23:36:53 +0400 |
commit | b98ff5cb5b2c14c33b16e3b129e1e08810e90a6c (patch) | |
tree | 02ba245a3520d769486a71a7aa50e26d97a0b52b /intern | |
parent | 714e717a0660c4961780a474218ff30a1b1aaf99 (diff) |
Fix T37303, Fix T37163: cycles mask layers that are also excluded not rendering
correct with multiple render layers.
This case is somewhat weak, we now do a few more checks on sync than I would
like, but it's not too bad.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index ba584e172dc..dfe97518a0f 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -267,13 +267,38 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P /* mesh sync */ object->mesh = sync_mesh(b_ob, object_updated, hide_tris); - /* sspecial case not tracked by object update flags */ + /* special case not tracked by object update flags */ + + /* holdout */ if(use_holdout != object->use_holdout) { object->use_holdout = use_holdout; scene->object_manager->tag_update(scene); object_updated = true; } + /* visibility flags for both parent and child */ + uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY; + if(b_parent.ptr.data != b_ob.ptr.data) { + visibility &= object_ray_visibility(b_parent); + object->random_id ^= hash_int(hash_string(b_parent.name().c_str())); + } + + /* make holdout objects on excluded layer invisible for non-camera rays */ + if(use_holdout && (layer_flag & render_layer.exclude_layer)) + visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA); + + /* camera flag is not actually used, instead is tested + * against render layer flags */ + if(visibility & PATH_RAY_CAMERA) { + visibility |= layer_flag << PATH_RAY_LAYER_SHIFT; + visibility &= ~PATH_RAY_CAMERA; + } + + if(visibility != object->visibility) { + object->visibility = visibility; + object_updated = true; + } + /* object sync * transform comparison should not be needed, but duplis don't work perfect * in the depsgraph and may not signal changes, so this is a workaround */ @@ -295,24 +320,10 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P else object->random_id = hash_int_2d(object->random_id, 0); - /* visibility flags for both parent */ - object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY; - if(b_parent.ptr.data != b_ob.ptr.data) { - object->visibility &= object_ray_visibility(b_parent); + if(b_parent.ptr.data != b_ob.ptr.data) object->random_id ^= hash_int(hash_string(b_parent.name().c_str())); - } - - /* make holdout objects on excluded layer invisible for non-camera rays */ - if(use_holdout && (layer_flag & render_layer.exclude_layer)) - object->visibility &= ~(PATH_RAY_ALL_VISIBILITY - PATH_RAY_CAMERA); - - /* camera flag is not actually used, instead is tested - * against render layer flags */ - if(object->visibility & PATH_RAY_CAMERA) { - object->visibility |= layer_flag << PATH_RAY_LAYER_SHIFT; - object->visibility &= ~PATH_RAY_CAMERA; - } + /* dupli texture coordinates */ if (b_dupli_ob) { object->dupli_generated = 0.5f*get_float3(b_dupli_ob.orco()) - make_float3(0.5f, 0.5f, 0.5f); object->dupli_uv = get_float2(b_dupli_ob.uv()); |