[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57042] trunk/blender/intern/cycles/kernel /closure/bsdf_util.h: Cycles / Fresnel:
Thomas Dinges
blender at dingto.org
Mon May 27 00:34:45 CEST 2013
Revision: 57042
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57042
Author: dingto
Date: 2013-05-26 22:34:45 +0000 (Sun, 26 May 2013)
Log Message:
-----------
Cycles / Fresnel:
* Avoid redundant assignment and use correct Normal for Ray Differentials.
Modified Paths:
--------------
trunk/blender/intern/cycles/kernel/closure/bsdf_util.h
Modified: trunk/blender/intern/cycles/kernel/closure/bsdf_util.h
===================================================================
--- trunk/blender/intern/cycles/kernel/closure/bsdf_util.h 2013-05-26 22:13:59 UTC (rev 57041)
+++ trunk/blender/intern/cycles/kernel/closure/bsdf_util.h 2013-05-26 22:34:45 UTC (rev 57042)
@@ -46,12 +46,7 @@
{
float cos = dot(N, I), neta;
float3 Nn;
- // compute reflection
- *R = (2 * cos)* N - I;
-#ifdef __RAY_DIFFERENTIALS__
- *dRdx = (2 * dot(N, dIdx)) * N - dIdx;
- *dRdy = (2 * dot(N, dIdy)) * N - dIdy;
-#endif
+
// check which side of the surface we are on
if(cos > 0) {
// we are on the outside of the surface, going in
@@ -60,13 +55,20 @@
*is_inside = false;
}
else {
- // we are inside the surface,
+ // we are inside the surface
cos = -cos;
neta = eta;
Nn = -N;
*is_inside = true;
}
+
+ // compute reflection
*R = (2 * cos)* Nn - I;
+#ifdef __RAY_DIFFERENTIALS__
+ *dRdx = (2 * dot(Nn, dIdx)) * Nn - dIdx;
+ *dRdy = (2 * dot(Nn, dIdy)) * Nn - dIdy;
+#endif
+
float arg = 1 -(neta * neta *(1 -(cos * cos)));
if(arg < 0) {
*T = make_float3(0.0f, 0.0f, 0.0f);
More information about the Bf-blender-cvs
mailing list