diff options
Diffstat (limited to 'intern/cycles/kernel/kernel_camera.h')
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index db2f45ce096..31a578e0b44 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -114,18 +114,20 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo /* ray differential */ ray->dP = differential3_zero(); - tD = transform_direction(&cameratoworld, Pcamera); - float3 Pdiff = spherical_stereo_position(kg, tD, Pcamera); - float3 Ddiff = spherical_stereo_direction(kg, tD, Pcamera, Pdiff); + float3 tD_diff = transform_direction(&cameratoworld, Pcamera); + float3 Pdiff = spherical_stereo_position(kg, tD_diff, Pcamera); + float3 Ddiff = spherical_stereo_direction(kg, tD_diff, Pcamera, Pdiff); - tP = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f)); - tD = transform_direction(&cameratoworld, tP); + tP = transform_perspective(&rastertocamera, + make_float3(raster_x + 1.0f, raster_y, 0.0f)); + tD = tD_diff + float4_to_float3(kernel_data.cam.dx); Pcamera = spherical_stereo_position(kg, tD, tP); ray->dD.dx = spherical_stereo_direction(kg, tD, tP, Pcamera) - Ddiff; ray->dP.dx = Pcamera - Pdiff; - tP = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); - tD = transform_direction(&cameratoworld, tP); + tP = transform_perspective(&rastertocamera, + make_float3(raster_x, raster_y + 1.0f, 0.0f)); + tD = tD_diff + float4_to_float3(kernel_data.cam.dy); Pcamera = spherical_stereo_position(kg, tD, tP); ray->dD.dy = spherical_stereo_direction(kg, tD, tP, Pcamera) - Ddiff; /* dP.dy is zero, since the omnidirectional panorama only shift the eyes horizontally */ |