Commit: 1d154fe27173ba849d7b3211ae91b47bf248ada0
Author: Sergey Sharybin
Date:   Fri Jul 29 16:37:02 2016 +0200
Branches: master
https://developer.blender.org/rB1d154fe27173ba849d7b3211ae91b47bf248ada0

Cycles: Fix wrong check for object is behind camera after recent fixes

===================================================================

M       intern/cycles/blender/blender_object.cpp

===================================================================

diff --git a/intern/cycles/blender/blender_object.cpp 
b/intern/cycles/blender/blender_object.cpp
index 22a0b39..da9e014 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -253,10 +253,17 @@ static bool object_boundbox_clip(Scene *scene,
                                       boundbox[3 * i + 1],
                                       boundbox[3 * i + 2]);
                p = transform_point(&tfm, p);
-               p = transform_perspective(&worldtondc, p);
-               if(p.z >= -margin) {
+
+               float4 b = make_float4(p.x, p.y, p.z, 1.0f);
+               float4 c = make_float4(dot(worldtondc.x, b),
+                                      dot(worldtondc.y, b),
+                                      dot(worldtondc.z, b),
+                                      dot(worldtondc.w, b));
+               if(c.z >= -margin) {
                        all_behind = false;
                }
+               c /= c.w;
+               p = float4_to_float3(c);
                bb_min = min(bb_min, p);
                bb_max = max(bb_max, p);
        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to