[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26665] trunk/blender/source/blender/ render/intern/source/shadeoutput.c: Fix #20147: AO + onlyshadow wasn' t being done right, also updated this

Brecht Van Lommel brecht at blender.org
Sun Feb 7 12:17:20 CET 2010


Revision: 26665
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26665
Author:   blendix
Date:     2010-02-07 12:17:19 +0100 (Sun, 07 Feb 2010)

Log Message:
-----------
Fix #20147: AO + onlyshadow wasn't being done right, also updated this
code to work with new ao/env separation.

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	2010-02-07 10:42:45 UTC (rev 26664)
+++ trunk/blender/source/blender/render/intern/source/shadeoutput.c	2010-02-07 11:17:19 UTC (rev 26665)
@@ -1538,18 +1538,21 @@
 	}
 	
 	/* quite disputable this...  also note it doesn't mirror-raytrace */	
-	if((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && shi->amb!=0.0f) {
+	if((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
 		float f;
 		
-		f= 1.0f - shi->ao[0];
-		f= R.wrld.aoenergy*f*shi->amb;
-		
-		if(R.wrld.aomix==WO_AOADD) {
-			shr->alpha += f;
-			shr->alpha *= f;
+		if(R.wrld.mode & WO_AMB_OCC) {
+			f= R.wrld.aoenergy*shi->amb;
+
+			if(R.wrld.aomix==WO_AOADD)
+				shr->alpha += f*(1.0f - rgb_to_grayscale(shi->ao));
+			else
+				shr->alpha= (1.0f - f)*shr->alpha + f*(1.0f - (1.0f - shr->alpha)*rgb_to_grayscale(shi->ao));
 		}
-		else if(R.wrld.aomix==WO_AOMUL) {
-			shr->alpha *= f;
+
+		if(R.wrld.mode & WO_ENV_LIGHT) {
+			f= R.wrld.ao_env_energy*shi->amb;
+			shr->alpha += f*(1.0f - rgb_to_grayscale(shi->env));
 		}
 	}
 }





More information about the Bf-blender-cvs mailing list