diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-11 12:43:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-11 12:45:35 +0300 |
commit | e7eb91365b3dc86e3555643ff8f89d7f306de900 (patch) | |
tree | 2249c7bd2f84c09b85c38ccfc06146450ba9f343 | |
parent | ebe306b8d2d0377705f9e3d66fe71465ab14d210 (diff) |
Cycles: Fix bug calculating dP for perspective camera
Was introduced by recent optimization. Not really sure derivatives are
intended to work like this, but better to stick to what Dalai had
originally for now.
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index e116ec394ac..b61ca1df51f 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -115,11 +115,13 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo /* ray differential */ ray->dP = differential3_zero(); + float3 Pdiff = spherical_stereo_position(kg, tD, Pcamera); + tP = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f)); tD = transform_direction(&cameratoworld, tP); Pcamera = spherical_stereo_position(kg, tD, tP); ray->dD.dx = normalize(spherical_stereo_direction(kg, tD, tP, Pcamera)) - ray->D; - ray->dP.dx = Pcamera - ray->P; + ray->dP.dx = Pcamera - Pdiff; tP = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); tD = transform_direction(&cameratoworld, tP); |