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.
This commit is contained in:
Sergey Sharybin 2015-01-14 02:34:49 +05:00
parent e6c79b7369
commit 54fd3f36a0
Notes: blender-bot 2023-02-14 09:37:53 +01:00
Referenced by issue #43195, Cycles and Freestyle - clipping plane / sphere problems
Referenced by issue #43195, Cycles and Freestyle - clipping plane / sphere problems
1 changed files with 4 additions and 2 deletions

View File

@ -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