Commit: b54447c0eb12d78cd1282db4cb3fb49a9be13b78
Author: Sergey Sharybin
Date:   Fri Oct 9 14:26:23 2015 +0500
Branches: master
https://developer.blender.org/rBb54447c0eb12d78cd1282db4cb3fb49a9be13b78

Cycles: Make sure ray direction is always normalized

Ray direction is assumed to be normalized in such areas as scaling intersection
distance on instance push/pop when doing ray-scene intersection, but it was
possible that some closures wouldn't give normalized direction which could cause
wrong intersection checks.

Now normalization will happen on surface bounce, which could be a bit of a waste
if closure actually gives normalized direction, but currently only transparent
BSDF seems to give guaranteed normalized direction.

===================================================================

M       intern/cycles/kernel/kernel_path_surface.h

===================================================================

diff --git a/intern/cycles/kernel/kernel_path_surface.h 
b/intern/cycles/kernel/kernel_path_surface.h
index fe85a6b..4485be8 100644
--- a/intern/cycles/kernel/kernel_path_surface.h
+++ b/intern/cycles/kernel/kernel_path_surface.h
@@ -150,7 +150,7 @@ ccl_device bool 
kernel_branched_path_surface_bounce(KernelGlobals *kg, RNG *rng,
 
        /* setup ray */
        ray->P = ray_offset(ccl_fetch(sd, P), (label & LABEL_TRANSMIT)? 
-ccl_fetch(sd, Ng): ccl_fetch(sd, Ng));
-       ray->D = bsdf_omega_in;
+       ray->D = normalize(bsdf_omega_in);
        ray->t = FLT_MAX;
 #ifdef __RAY_DIFFERENTIALS__
        ray->dP = ccl_fetch(sd, dP);
@@ -257,7 +257,7 @@ ccl_device_inline bool 
kernel_path_surface_bounce(KernelGlobals *kg, ccl_addr_sp
 
                /* setup ray */
                ray->P = ray_offset(ccl_fetch(sd, P), (label & LABEL_TRANSMIT)? 
-ccl_fetch(sd, Ng): ccl_fetch(sd, Ng));
-               ray->D = bsdf_omega_in;
+               ray->D = normalize(bsdf_omega_in);
 
                if(state->bounce == 0)
                        ray->t -= ccl_fetch(sd, ray_length); /* clipping works 
through transparent */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to