[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27336] branches/render25: Render Branch:

Brecht Van Lommel brecht at blender.org
Mon Mar 8 19:55:11 CET 2010


Revision: 27336
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27336
Author:   blendix
Date:     2010-03-08 19:55:11 +0100 (Mon, 08 Mar 2010)

Log Message:
-----------
Render Branch:

* AO/env/indirect now optionally supports bump mapping.
* Irradiance cache code was extended to support storing spherical
  harmonics, for more efficiently dealing with bump maps without
  adding loads of samples. This does not work yet however, and so
  the code is still disabled.
* Move ao/env/indirect computation inside the shading loop.

Modified Paths:
--------------
    branches/render25/release/scripts/ui/properties_world.py
    branches/render25/source/blender/blenkernel/intern/anim.c
    branches/render25/source/blender/blenkernel/intern/world.c
    branches/render25/source/blender/blenlib/BLI_math_geom.h
    branches/render25/source/blender/blenlib/intern/math_geom_inline.c
    branches/render25/source/blender/blenloader/intern/readfile.c
    branches/render25/source/blender/makesdna/DNA_world_types.h
    branches/render25/source/blender/makesrna/intern/rna_world.c
    branches/render25/source/blender/render/intern/include/cache.h
    branches/render25/source/blender/render/intern/include/raytrace.h
    branches/render25/source/blender/render/intern/include/shading.h
    branches/render25/source/blender/render/intern/source/bake.c
    branches/render25/source/blender/render/intern/source/cache.c
    branches/render25/source/blender/render/intern/source/camera.c
    branches/render25/source/blender/render/intern/source/convertblender.c
    branches/render25/source/blender/render/intern/source/diskocclusion.c
    branches/render25/source/blender/render/intern/source/environment.c
    branches/render25/source/blender/render/intern/source/object_mesh.c
    branches/render25/source/blender/render/intern/source/object_strand.c
    branches/render25/source/blender/render/intern/source/rayshade.c
    branches/render25/source/blender/render/intern/source/rendercore.c
    branches/render25/source/blender/render/intern/source/shadeinput.c
    branches/render25/source/blender/render/intern/source/shadeoutput.c

Modified: branches/render25/release/scripts/ui/properties_world.py
===================================================================
--- branches/render25/release/scripts/ui/properties_world.py	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/release/scripts/ui/properties_world.py	2010-03-08 18:55:11 UTC (rev 27336)
@@ -261,6 +261,7 @@
         col = split.column()
 
         col.prop(light, "use_cache")
+        col.prop(light, "bump_method")
 
         if light.gather_method == 'RAYTRACE':
             col.label(text="Attenuation:")

Modified: branches/render25/source/blender/blenkernel/intern/anim.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/anim.c	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/source/blender/blenkernel/intern/anim.c	2010-03-08 18:55:11 UTC (rev 27336)
@@ -86,7 +86,7 @@
 /* --------------------- */
 /* forward declarations */
 
-static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated);
+static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float obmat[4][4], float par_space_mat[4][4], int level, int animated);
 
 /* ******************************************************************** */
 /* Animation Visualisation */
@@ -659,9 +659,9 @@
 			dob->no_draw= (dob->origlay & group->layer)==0;
 			
 			if(go->ob->transflag & OB_DUPLI) {
-				copy_m4_m4(dob->ob->obmat, dob->mat);
-				object_duplilist_recursive((ID *)group, scene, go->ob, lb, ob->obmat, level+1, animated);
-				copy_m4_m4(dob->ob->obmat, dob->omat);
+				//copy_m4_m4(dob->ob->obmat, dob->mat);
+				object_duplilist_recursive((ID *)group, scene, go->ob, lb, dob->mat, ob->obmat, level+1, animated);
+				//copy_m4_m4(dob->ob->obmat, dob->omat);
 			}
 		}
 	}
@@ -754,11 +754,11 @@
 		VECCOPY(dob->orco, vdd->orco[index]);
 	
 	if(vdd->ob->transflag & OB_DUPLI) {
-		float tmpmat[4][4];
-		copy_m4_m4(tmpmat, vdd->ob->obmat);
-		copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
-		object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, vdd->level+1, vdd->animated);
-		copy_m4_m4(vdd->ob->obmat, tmpmat);
+		//float tmpmat[4][4];
+		//copy_m4_m4(tmpmat, vdd->ob->obmat);
+		//copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
+		object_duplilist_recursive((ID *)vdd->id, vdd->scene, vdd->ob, vdd->lb, obmat, obmat, vdd->level+1, vdd->animated);
+		//copy_m4_m4(vdd->ob->obmat, tmpmat);
 	}
 }
 
@@ -1042,10 +1042,10 @@
 						
 						if(ob->transflag & OB_DUPLI) {
 							float tmpmat[4][4];
-							copy_m4_m4(tmpmat, ob->obmat);
-							copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
-							object_duplilist_recursive((ID *)id, scene, ob, lb, ob->obmat, level+1, animated);
-							copy_m4_m4(ob->obmat, tmpmat);
+							//copy_m4_m4(tmpmat, ob->obmat);
+							//copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
+							object_duplilist_recursive((ID *)id, scene, ob, lb, obmat, ob->obmat, level+1, animated);
+							//copy_m4_m4(ob->obmat, tmpmat);
 						}
 					}
 					
@@ -1378,7 +1378,7 @@
 
 /* ------------- */
 
-static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated)
+static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float obmat[4][4], float par_space_mat[4][4], int level, int animated)
 {	
 	if((ob->transflag & OB_DUPLI)==0)
 		return;
@@ -1436,7 +1436,7 @@
 {
 	ListBase *duplilist= MEM_mallocN(sizeof(ListBase), "duplilist");
 	duplilist->first= duplilist->last= NULL;
-	object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, 0, 0);
+	object_duplilist_recursive((ID *)sce, sce, ob, duplilist, NULL, NULL, 0, 0); /* XXX */
 	return duplilist;
 }
 

Modified: branches/render25/source/blender/blenkernel/intern/world.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/world.c	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/source/blender/blenkernel/intern/world.c	2010-03-08 18:55:11 UTC (rev 27336)
@@ -106,7 +106,7 @@
 	wrld->ao_indirect_energy= 1.0f;
 	wrld->ao_indirect_bounces= 1;
 	wrld->aobias= 0.05f;
-	wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;	
+	wrld->ao_samp_method = WO_LIGHT_SAMP_HAMMERSLEY;	
 	wrld->ao_approx_error= 0.25f;
 	
 	wrld->preview = NULL;

Modified: branches/render25/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- branches/render25/source/blender/blenlib/BLI_math_geom.h	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/source/blender/blenlib/BLI_math_geom.h	2010-03-08 18:55:11 UTC (rev 27336)
@@ -186,12 +186,15 @@
    1 = (1,-1), 2 = (1,0), 3 = (1,1),
    4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
 
+MINLINE void zero_sh(float r[9]);
 MINLINE void copy_sh_sh(float r[9], float a[9]);
 MINLINE void mul_sh_fl(float r[9], float f);
 MINLINE void add_sh_shsh(float r[9], float a[9], float b[9]);
 
 MINLINE float eval_shv3(float r[9], float v[3]);
-MINLINE void vec_fac_to_sh(float r[9], float v[3], float fac);
+MINLINE float diffuse_shv3(float r[9], float v[3]);
+MINLINE void vec_fac_to_sh(float r[9], float v[3], float f);
+MINLINE void madd_sh_shfl(float r[9], float sh[3], float f);
 
 /********************************* Form Factor *******************************/
 

Modified: branches/render25/source/blender/blenlib/intern/math_geom_inline.c
===================================================================
--- branches/render25/source/blender/blenlib/intern/math_geom_inline.c	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/source/blender/blenlib/intern/math_geom_inline.c	2010-03-08 18:55:11 UTC (rev 27336)
@@ -32,6 +32,11 @@
 
 /****************************** Spherical Harmonics **************************/
 
+MINLINE void zero_sh(float r[9])
+{
+	memset(r, 0, sizeof(float)*9);
+}
+
 MINLINE void copy_sh_sh(float r[9], float a[9])
 {
 	memcpy(r, a, sizeof(float)*9);
@@ -53,8 +58,18 @@
 		r[i]= a[i] + b[i];
 }
 
+MINLINE float dot_shsh(float a[9], float b[9])
+{
+	float r= 0.0f;
+	int i;
 
-MINLINE float eval_shv3(float sh[9], float v[3])
+	for(i=0; i<9; i++)
+		r += a[i]*b[i];
+	
+	return r;
+}
+
+MINLINE float diffuse_shv3(float sh[9], float v[3])
 {
 	/* See formula (13) in:
 	   "An Efficient Representation for Irradiance Environment Maps" */
@@ -76,7 +91,7 @@
 	return sum;
 }
 
-MINLINE void vec_fac_to_sh(float r[9], float v[3], float fac)
+MINLINE void vec_fac_to_sh(float r[9], float v[3], float f)
 {
 	/* See formula (3) in:
 	   "An Efficient Representation for Irradiance Environment Maps" */
@@ -98,9 +113,26 @@
 	sh[7]= 1.092548f*x*z;
 	sh[8]= 0.546274f*(x*x - y*y);
 
-	mul_sh_fl(sh, fac);
+	mul_sh_fl(sh, f);
 	copy_sh_sh(r, sh);
 }
 
+MINLINE float eval_shv3(float sh[9], float v[3])
+{
+	float tmp[9];
+
+	vec_fac_to_sh(tmp, v, 1.0f);
+	return dot_shsh(tmp, sh);
+}
+
+MINLINE void madd_sh_shfl(float r[9], float sh[3], float f)
+{
+	float tmp[9];
+
+	copy_sh_sh(tmp, sh);
+	mul_sh_fl(tmp, f);
+	add_sh_shsh(r, r, tmp);
+}
+
 #endif /* BLI_MATH_GEOM_INLINE */
 

Modified: branches/render25/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/render25/source/blender/blenloader/intern/readfile.c	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/source/blender/blenloader/intern/readfile.c	2010-03-08 18:55:11 UTC (rev 27336)
@@ -6420,8 +6420,8 @@
 			tex->type= TEX_NODES;
 
 	for(wo= main->world.first; wo; wo= wo->id.next)
-		if(wo->ao_samp_method == WO_AOSAMP_CONSTANT)
-			wo->ao_samp_method= WO_AOSAMP_HAMMERSLEY;
+		if(wo->ao_samp_method == WO_LIGHT_SAMP_CONSTANT)
+			wo->ao_samp_method= WO_LIGHT_SAMP_HAMMERSLEY;
 
 	for(la= main->lamp.first; la; la= la->id.next) {
 		if(la->ray_samp_method == LA_SAMP_CONSTANT)
@@ -8082,8 +8082,8 @@
 			/* People can still explicitely choose for Sumo (after 2.42 is out) */
 			if(main->versionfile > 225)
 				wo->physicsEngine = WOPHY_BULLET;
-			if(WO_AODIST == wo->aomode)
-				wo->aocolor= WO_AOPLAIN;
+			if(WO_LIGHT_DIST == wo->aomode)
+				wo->aocolor= WO_ENV_LIGHT_WHITE;
 		}
 		
 		/* updating layers still */
@@ -8560,9 +8560,9 @@
 			
 			for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
 				if (wrld->mode & WO_AMB_OCC)
-					wrld->ao_samp_method = WO_AOSAMP_CONSTANT;
+					wrld->ao_samp_method = WO_LIGHT_SAMP_CONSTANT;
 				else
-					wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
+					wrld->ao_samp_method = WO_LIGHT_SAMP_HAMMERSLEY;
 				
 				wrld->ao_adapt_thresh = 0.005f;
 			}
@@ -10609,12 +10609,12 @@
 			else
 				wo->mode |= WO_INDIRECT_LIGHT;
 
-			if(wo->aomix == WO_AOSUB)
+			if(wo->aomix == WO_AO_SUB)
 				wo->ao_env_energy= -wo->ao_env_energy;
-			else if(wo->aomix == WO_AOADDSUB)
+			else if(wo->aomix == WO_AO_ADDSUB)
 				wo->mode |= WO_AMB_OCC;
 
-			wo->aomix= WO_AOMUL;
+			wo->aomix= WO_AO_MUL;
 
 			/* ambient default from 0.5f to 1.0f */
 			mul_v3_fl(&wo->ambr, 0.5f);

Modified: branches/render25/source/blender/makesdna/DNA_world_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_world_types.h	2010-03-08 18:36:17 UTC (rev 27335)
+++ branches/render25/source/blender/makesdna/DNA_world_types.h	2010-03-08 18:55:11 UTC (rev 27336)
@@ -103,7 +103,7 @@
 	float ao_adapt_thresh, ao_adapt_speed_fac;
 	float ao_approx_error, ao_approx_correction;
 	float ao_indirect_energy, ao_env_energy, ao_pad2;
-	short ao_indirect_bounces, ao_pad;
+	short ao_indirect_bounces, ao_bump_method;
 	short ao_samp_method, ao_gather_method, ao_approx_passes;
 	
 	/* assorted settings (in the middle of ambient occlusion settings for padding reasons) */
@@ -143,31 +143,36 @@
 #define WO_INDIRECT_LIGHT	  128
 
 /* aomix */
-#define WO_AOADD	0
-#define WO_AOSUB	1 /* deprecated */
-#define WO_AOADDSUB	2 /* deprecated */
-#define WO_AOMUL	3
+#define WO_AO_ADD		0
+#define WO_AO_SUB		1 /* deprecated */
+#define WO_AO_ADDSUB	2 /* deprecated */
+#define WO_AO_MUL		3
 
 /* ao_samp_method - methods for sampling the AO hemi */
-#define WO_AOSAMP_CONSTANT			0		/* Deprecated */
-#define WO_AOSAMP_HALTON			1
-#define WO_AOSAMP_HAMMERSLEY		2
+#define WO_LIGHT_SAMP_CONSTANT		0		/* Deprecated */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list