[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13614] trunk/blender/source/blender/ render/intern/source:

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Feb 9 17:30:34 CET 2008


Revision: 13614
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13614
Author:   blendix
Date:     2008-02-09 17:30:33 +0100 (Sat, 09 Feb 2008)

Log Message:
-----------

- Bugfix: scenes with SSS materials slowed down preview render
  unnecessarily.
- Small approximate AO optimization for sky colors/textures.

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

Modified: trunk/blender/source/blender/render/intern/source/occlusion.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/occlusion.c	2008-02-09 00:08:07 UTC (rev 13613)
+++ trunk/blender/source/blender/render/intern/source/occlusion.c	2008-02-09 16:30:33 UTC (rev 13614)
@@ -725,9 +725,9 @@
 
 /* ------------------------- Traversal --------------------------- */
 
-static float occ_solid_angle(OccNode *node, float *v, float d2, float *receivenormal)
+static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, float *receivenormal)
 {
-	float dotreceive, dotemit, invd2 = 1.0f/sqrtf(d2);
+	float dotreceive, dotemit;
 	float ev[3];
 
 	ev[0]= -v[0]*invd2;
@@ -1189,7 +1189,7 @@
 {
 	OccNode *node, **stack;
 	OccFace *face;
-	float resultocc, v[3], p[3], n[3], co[3];
+	float resultocc, v[3], p[3], n[3], co[3], invd2;
 	float distfac, fac, error, d2, weight, emitarea;
 	int b, totstack;
 
@@ -1229,14 +1229,14 @@
 				fac= 1.0f;
 
 			/* accumulate occlusion from spherical harmonics */
-			weight= occ_solid_angle(node, v, d2, n);
+			invd2 = 1.0f/sqrt(d2);
+			weight= occ_solid_angle(node, v, d2, invd2, n);
 			weight *= node->occlusion;
 
 			if(bentn) {
-				Normalize(v);
-				bentn[0] -= weight*v[0];
-				bentn[1] -= weight*v[1];
-				bentn[2] -= weight*v[2];
+				bentn[0] -= weight*invd2*v[0];
+				bentn[1] -= weight*invd2*v[1];
+				bentn[2] -= weight*invd2*v[2];
 			}
 
 			resultocc += weight*fac;
@@ -1265,10 +1265,10 @@
 						weight *= tree->occlusion[node->child[b].face];
 
 						if(bentn) {
-							Normalize(v);
-							bentn[0] -= weight*v[0];
-							bentn[1] -= weight*v[1];
-							bentn[2] -= weight*v[2];
+							invd2= 1.0f/sqrt(d2);
+							bentn[0] -= weight*invd2*v[0];
+							bentn[1] -= weight*invd2*v[1];
+							bentn[2] -= weight*invd2*v[2];
 						}
 
 						resultocc += weight*fac;

Modified: trunk/blender/source/blender/render/intern/source/sss.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/sss.c	2008-02-09 00:08:07 UTC (rev 13613)
+++ trunk/blender/source/blender/render/intern/source/sss.c	2008-02-09 16:30:33 UTC (rev 13614)
@@ -985,7 +985,7 @@
 	re->stats_draw(&re->i);
 	
 	for(mat= G.main->mat.first; mat; mat= mat->id.next)
-		if(mat->id.us && (mat->sss_flag & MA_DIFF_SSS))
+		if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
 			sss_create_tree_mat(re, mat);
 }
 





More information about the Bf-blender-cvs mailing list