From 694806a9cfbfef8a8f4cfa0ab7d37a448d0f1bb3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 19 Jan 2015 19:28:28 +0500 Subject: Cycles: Correction to camera in volume detection after clipping commit The check should also become aware of the fact were using clipping plane instead of clipping sphere now. --- intern/cycles/render/camera.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'intern/cycles/render/camera.cpp') diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 5b0d51e60c2..7be3949d138 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -346,6 +346,7 @@ float3 Camera::transform_raster_to_world(float raster_x, float raster_y) if(type == CAMERA_PERSPECTIVE) { D = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); + float3 Pclip = normalize(D); P = make_float3(0.0f, 0.0f, 0.0f); /* TODO(sergey): Aperture support? */ P = transform_point(&cameratoworld, P); @@ -354,7 +355,7 @@ float3 Camera::transform_raster_to_world(float raster_x, float raster_y) * be mistakes in here, currently leading to wrong camera-in-volume * detection. */ - P += nearclip * D; + P += nearclip * D / Pclip.z; } else if (type == CAMERA_ORTHOGRAPHIC) { D = make_float3(0.0f, 0.0f, 1.0f); -- cgit v1.2.3