diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-14 00:34:49 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-14 00:34:49 +0300 |
commit | 54fd3f36a047b4d394c935a0aa387ae8a7b6a8c5 (patch) | |
tree | 43c367332ba3ba0dd0dedfb7b193051e5b17e01b /intern | |
parent | e6c79b73691183487b67b8cdde87be60bf298847 (diff) |
Fix T43195: Cycles uses clipping sphere instead of clipping plane
Basically the title tells it all, now Cycles uses proper clipping plane,
matching other render engines.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 63a3cad1d34..e6d5714914c 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -88,8 +88,10 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo #ifdef __CAMERA_CLIPPING__ /* clipping */ - ray->P += kernel_data.cam.nearclip*ray->D; - ray->t = kernel_data.cam.cliplength; + float3 Pclip = normalize(Pcamera); + float z_inv = 1.0f / Pclip.z; + ray->P += kernel_data.cam.nearclip*ray->D * z_inv; + ray->t = kernel_data.cam.cliplength * z_inv; #else ray->t = FLT_MAX; #endif |