[Bf-blender-cvs] [694806a] master: Cycles: Correction to camera in volume detection after clipping commit

Sergey Sharybin noreply at git.blender.org
Mon Jan 19 15:29:26 CET 2015


Commit: 694806a9cfbfef8a8f4cfa0ab7d37a448d0f1bb3
Author: Sergey Sharybin
Date:   Mon Jan 19 19:28:28 2015 +0500
Branches: master
https://developer.blender.org/rB694806a9cfbfef8a8f4cfa0ab7d37a448d0f1bb3

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.

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

M	intern/cycles/render/camera.cpp

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

diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 5b0d51e..7be3949 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);




More information about the Bf-blender-cvs mailing list