diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-10 19:47:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-10 19:48:12 +0300 |
commit | 59a7204797a426f6ca36cbeb6fcff13e4b717863 (patch) | |
tree | 9751617e7c07fb6a7e82a94d44bf9931215e8b06 | |
parent | 033b0789c8fb17f0a9e6f66ff0a6fb9df53af236 (diff) |
Cycles: Simplify perspective camera derivatives calculation
Probably some further simplification is possible, will look into this later.
Alternatively will get rid of KernelCamera.{dx, dy}.
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 0947946e63d..cddb87d0cc0 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -115,16 +115,13 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo /* ray differential */ ray->dP = differential3_zero(); - tP = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); - tD = transform_direction(&cameratoworld, tP); - float3 Pdiff = spherical_stereo_position(kg, tD, tP); - float3 Ddiff = normalize(spherical_stereo_direction(kg, tD, tP, Pdiff)); + const float3 Ddiff = normalize(ray->D); 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)) - Ddiff; - ray->dP.dx = Pcamera - Pdiff; + ray->dP.dx = Pcamera - ray->P; tP = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); tD = transform_direction(&cameratoworld, tP); |