All pastes #804071 Raw Edit

trans ao

public text v1 · immutable
·published 2007-12-03 02:19 UTC
rendered paste body
Index: blender/render/intern/source/rayshade.c
===================================================================
--- blender/render/intern/source/rayshade.c	(revision 12706)
+++ blender/render/intern/source/rayshade.c	(working copy)
@@ -1508,8 +1508,19 @@
 		prev = fac;
 		
 		if(RE_ray_tree_intersect(R.raytree, &isec)) {
-			if (R.wrld.aomode & WO_AODIST) fac+= exp(-isec.labda*R.wrld.aodistfac); 
-			else fac+= 1.0f;
+			VlakRen *vlr= (VlakRen*)isec.face;
+			float transfact;
+			if (vlr->mat->mode & MA_RAYTRANSP){
+				transfact=vlr->mat->alpha;
+				if (vlr->mat->mode & MA_RAYMIRROR)
+					transfact=(vlr->mat->ray_mirror+transfact)/2.0f;
+			}
+			else
+				transfact=1.0;
+			if (R.wrld.aomode & WO_AODIST) {
+				fac+= transfact*exp(-isec.labda*R.wrld.aodistfac); 
+			}
+			else fac+= transfact*1.0f;
 		}
 		else if(aocolor!=WO_AOPLAIN) {
 			float skycol[4];
@@ -1627,8 +1638,20 @@
 			
 			/* do the trace */
 			if(RE_ray_tree_intersect(R.raytree, &isec)) {
-				if (R.wrld.aomode & WO_AODIST) sh+= exp(-isec.labda*R.wrld.aodistfac); 
-				else sh+= 1.0f;
+				VlakRen *vlr= (VlakRen*)isec.face;
+				float transfact;
+				if (vlr->mat->mode & MA_RAYTRANSP){
+					transfact=vlr->mat->alpha;
+					if (vlr->mat->mode & MA_RAYMIRROR)
+						transfact=(vlr->mat->ray_mirror+transfact)/2.0f;
+				}
+				else
+					transfact=1.0;
+				if (R.wrld.aomode & WO_AODIST){
+					VlakRen *vlr= (VlakRen*)isec.face;
+					sh+= transfact*exp(-isec.labda*R.wrld.aodistfac); 
+				}
+				else sh+= transfact*1.0f;
 			}
 			else if(aocolor!=WO_AOPLAIN) {
 				float skycol[4];
@@ -1683,6 +1706,9 @@