diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-29 17:37:02 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-29 18:30:24 +0300 |
commit | 1d154fe27173ba849d7b3211ae91b47bf248ada0 (patch) | |
tree | a0bd6a2d66fc51d42a9104d2c2e299d9f0ac6913 | |
parent | cdc7a24d7b56aed874aefe4d37c6acb1cfcae346 (diff) |
Cycles: Fix wrong check for object is behind camera after recent fixes
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 22a0b3988c8..da9e0141e76 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); } |