[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27604] branches/render25/source/blender/ render/intern/source: Render Branch: Clamp diffuse/specular to be >= 0 after indirect light,
Brecht Van Lommel
brecht at blender.org
Thu Mar 18 18:05:18 CET 2010
Revision: 27604
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27604
Author: blendix
Date: 2010-03-18 18:05:17 +0100 (Thu, 18 Mar 2010)
Log Message:
-----------
Render Branch: Clamp diffuse/specular to be >= 0 after indirect light,
so that negative lamps also can darken it.
Modified Paths:
--------------
branches/render25/source/blender/render/intern/source/lamp.c
branches/render25/source/blender/render/intern/source/shadeoutput.c
Modified: branches/render25/source/blender/render/intern/source/lamp.c
===================================================================
--- branches/render25/source/blender/render/intern/source/lamp.c 2010-03-18 15:29:55 UTC (rev 27603)
+++ branches/render25/source/blender/render/intern/source/lamp.c 2010-03-18 17:05:17 UTC (rev 27604)
@@ -94,10 +94,10 @@
factor = 1.0f;
break;
case LA_FALLOFF_INVLINEAR:
- factor = 1.0f/(dist + lar->falloff_smooth*lar->power + LAMP_FALLOFF_MIN_DIST);
+ factor = 1.0f/(dist + lar->falloff_smooth*fabsf(lar->power) + LAMP_FALLOFF_MIN_DIST);
break;
case LA_FALLOFF_INVSQUARE:
- factor = 1.0f/(dist*dist + lar->falloff_smooth*lar->power + LAMP_FALLOFF_MIN_DIST);
+ factor = 1.0f/(dist*dist + lar->falloff_smooth*fabsf(lar->power) + LAMP_FALLOFF_MIN_DIST);
break;
case LA_FALLOFF_CURVE:
factor = curvemapping_evaluateF(lar->curfalloff, 0, dist/lar->dist);
Modified: branches/render25/source/blender/render/intern/source/shadeoutput.c
===================================================================
--- branches/render25/source/blender/render/intern/source/shadeoutput.c 2010-03-18 15:29:55 UTC (rev 27603)
+++ branches/render25/source/blender/render/intern/source/shadeoutput.c 2010-03-18 17:05:17 UTC (rev 27604)
@@ -666,15 +666,6 @@
}
}
- /* prevent only shadow lamps from producing negative colors.*/
- if(shr->spec[0] < 0) shr->spec[0] = 0;
- if(shr->spec[1] < 0) shr->spec[1] = 0;
- if(shr->spec[2] < 0) shr->spec[2] = 0;
-
- if(shr->diff[0] < 0) shr->diff[0] = 0;
- if(shr->diff[1] < 0) shr->diff[1] = 0;
- if(shr->diff[2] < 0) shr->diff[2] = 0;
-
/* we now have unshadowed result in shr->shad, turn it into shadow by
dividing shadowed diffuse and specular by unshadowed. it's not possible
to clearly do the separation for compositing ... */
@@ -740,6 +731,15 @@
}
}
}
+
+ /* clamp diff/spec to be positive after direct and indirect */
+ if(shr->spec[0] < 0) shr->spec[0] = 0;
+ if(shr->spec[1] < 0) shr->spec[1] = 0;
+ if(shr->spec[2] < 0) shr->spec[2] = 0;
+
+ if(shr->diff[0] < 0) shr->diff[0] = 0;
+ if(shr->diff[1] < 0) shr->diff[1] = 0;
+ if(shr->diff[2] < 0) shr->diff[2] = 0;
}
static void shade_surface_sss(Render *re, ShadeInput *shi, ShadeResult *shr)
More information about the Bf-blender-cvs
mailing list