[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43972] trunk/blender/source/blender/ render/intern/source/shadeoutput.c: Fix #30081: the fix for #30026 related to rendering indirect/environment light

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Feb 7 22:04:21 CET 2012


Revision: 43972
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43972
Author:   blendix
Date:     2012-02-07 21:04:10 +0000 (Tue, 07 Feb 2012)
Log Message:
-----------
Fix #30081: the fix for #30026 related to rendering indirect/environment light
with material ambient zero broke backwards compatibility too much. The behavior
to have ambient zero affect things even if it is not used as a factor does not
make much sense but keeps things compatible. Now instead fixed the use of
uninitialized memory.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/shadeoutput.c

Modified: trunk/blender/source/blender/render/intern/source/shadeoutput.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/shadeoutput.c	2012-02-07 20:51:33 UTC (rev 43971)
+++ trunk/blender/source/blender/render/intern/source/shadeoutput.c	2012-02-07 21:04:10 UTC (rev 43972)
@@ -1030,12 +1030,17 @@
 /* preprocess, textures were not done, don't use shi->amb for that reason */
 void ambient_occlusion(ShadeInput *shi)
 {
-	if(R.wrld.ao_gather_method == WO_AOGATHER_APPROX)
+	if((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f) {
 		sample_occ(&R, shi);
-	else if(R.r.mode & R_RAYTRACE)
+	}
+	else if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
 		ray_ao(shi, shi->ao, shi->env);
-	else
+	}
+	else {
 		shi->ao[0]= shi->ao[1]= shi->ao[2]= 1.0f;
+		zero_v3(shi->env);
+		zero_v3(shi->indirect);
+	}
 }
 
 




More information about the Bf-blender-cvs mailing list