Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-10-09 12:26:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-10-09 13:58:03 +0300
commitb54447c0eb12d78cd1282db4cb3fb49a9be13b78 (patch)
tree0bbe045bee923182588e626983b9aa1dcc2c7217 /intern
parent29247a7a0504d8755903e95744fbf13774e450cb (diff)
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.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/kernel_path_surface.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_path_surface.h b/intern/cycles/kernel/kernel_path_surface.h
index fe85a6b6e4b..4485be8a5b3 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 */