Fix #30603: cycles incorrect ray differentials when rendering with panorama
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 20 Mar 2012 19:32:12 +0000 (19:32 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 20 Mar 2012 19:32:12 +0000 (19:32 +0000)
camera, causing bump map issues.

intern/cycles/kernel/kernel_camera.h

index 251b2c280dafebdaaaca98ee450d88089fdef43b..0460765fe862552b91eebd4cda69e22f819d5dc9 100644 (file)
@@ -146,10 +146,10 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float
        ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f);
 
        Pcamera = transform(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
-       ray->dD.dx = equirectangular_to_direction(Pcamera.x, Pcamera.y) - ray->D;
+       ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
 
        Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
-       ray->dD.dy = equirectangular_to_direction(Pcamera.x, Pcamera.y) - ray->D;
+       ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
 #endif
 
 #ifdef __CAMERA_CLIPPING__