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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user