[Bf-blender-cvs] [59a7204] master: Cycles: Simplify perspective camera derivatives calculation
Sergey Sharybin
noreply at git.blender.org
Thu Mar 10 18:05:41 CET 2016
Commit: 59a7204797a426f6ca36cbeb6fcff13e4b717863
Author: Sergey Sharybin
Date: Thu Mar 10 21:47:44 2016 +0500
Branches: master
https://developer.blender.org/rB59a7204797a426f6ca36cbeb6fcff13e4b717863
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}.
===================================================================
M intern/cycles/kernel/kernel_camera.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 0947946..cddb87d 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);
More information about the Bf-blender-cvs
mailing list