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.
This commit is contained in:
Brecht Van Lommel 2013-11-26 20:34:29 +01:00
parent 714e717a06
commit b98ff5cb5b
Notes: blender-bot 2023-02-14 11:41:34 +01:00
Referenced by commit 5b0e4cd8c9, Fix T41003: Object Info's Random socket produces erratic results when
Referenced by issue #37303, Render single renderlayer gives different result than rendering all renderlayers
Referenced by issue #37163, Toggling Mask layers seems to influence Ray Visisbility
3 changed files with 30 additions and 19 deletions

View File

@ -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());

@ -1 +1 @@
Subproject commit 6501c6cadfef1804dfa4b7aa2eb208207570a42a
Subproject commit dbf7e49d9b37fa61b5c42d33864f6b4fbfa6d705

@ -1 +1 @@
Subproject commit 6695fc64a51fcc64c96bc31c5b209a54d8ea9ba6
Subproject commit 4fe6a9e046f9578a0dadb1186269ac5e406a8c15