[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16291] branches/soc-2008-unclezeiv/source /blender: Added toggles to disable specularity in environment lighting and from indirect lighting .

Davide Vercelli davide.vercelli at gmail.com
Thu Aug 28 23:20:12 CEST 2008


Revision: 16291
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16291
Author:   unclezeiv
Date:     2008-08-28 23:19:25 +0200 (Thu, 28 Aug 2008)

Log Message:
-----------
Added toggles to disable specularity in environment lighting and from indirect lighting. Also, the "No specular" toggle from area lights is now honoured, and in general "no specular" lights generate "no specular" virtual point lights.

Modified Paths:
--------------
    branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
    branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c

Modified: branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h	2008-08-28 19:37:49 UTC (rev 16290)
+++ branches/soc-2008-unclezeiv/source/blender/makesdna/DNA_scene_types.h	2008-08-28 21:19:25 UTC (rev 16291)
@@ -318,12 +318,12 @@
 	int lightcuts_max_cut;
 	short lightcuts_env_map;
 	short lightcuts_indirect;
+	short lightcuts_color_weight;
+	short lightcuts_pad;
 	float lightcuts_indir_fac;
-	short lightcuts_options;
-	short lightcuts_color_weight;
+	int lightcuts_options;
 	float lightcuts_indir_dist;
 	float lightcuts_env_map_fac;
-	int lightcuts_pad;
 	int lightcuts_debug_options;
 } RenderData;
 

Modified: branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c	2008-08-28 19:37:49 UTC (rev 16290)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c	2008-08-28 21:19:25 UTC (rev 16291)
@@ -92,12 +92,14 @@
 #define FALLOFF_MIX    3
 #define FALLOFF_SLIDER 3
 
-#define LC_OPT_FIXED_DIRS  0x01
-#define LC_OPT_ONLY_INDIR  0x02
-#define LC_OPT_2ND_BOUNCE  0x04
-#define LC_OPT_ENV_LIGHT   0x08
-#define LC_OPT_INDIR_MESH  0x10
-#define LC_OPT_NO_CLAMP    0x20
+#define LC_OPT_FIXED_DIRS  0x0001
+#define LC_OPT_ONLY_INDIR  0x0002
+#define LC_OPT_2ND_BOUNCE  0x0004
+#define LC_OPT_ENV_LIGHT   0x0008
+#define LC_OPT_INDIR_MESH  0x0010
+#define LC_OPT_NO_CLAMP    0x0020
+#define LC_OPT_ENV_NOSPEC  0x0040
+#define LC_OPT_IND_NOSPEC  0x0080
 
 #define LC_LAR_INDIR 0x01
 
@@ -876,6 +878,9 @@
 	lar->dist= orig->dist;
 	lar->distkw= lar->dist * lar->dist; /* who uses this? */
 	
+	if (orig->mode & LA_NO_SPEC)
+		lar->mode |= LA_NO_SPEC;
+	
 	lar->lay= orig->lay;
 	/* same as original area light */
 	VECCOPY(lar->vec, orig->vec);
@@ -956,6 +961,9 @@
 		lamp_init(re, lar);
 		lar->type = LA_SUN;
 		
+		if (lcd->options & LC_OPT_ENV_NOSPEC)
+			lar->mode |= LA_NO_SPEC;
+		
 		lar->lay= 0xffffffff; /* XXX: check */
 		
 		VECCOPY(lar->co, co);
@@ -1406,6 +1414,9 @@
 	
 	lar->lightcuts_options= LC_LAR_INDIR;
 	
+	if (orig->mode & LA_NO_SPEC || lcd->options & LC_OPT_IND_NOSPEC)
+		lar->mode |= LA_NO_SPEC;
+	
 	/* lamp is oriented as (negated) face normal */
 	VECCOPY(lar->vec, vla->n);
 	VECNEG(lar->vec);

Modified: branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c
===================================================================
--- branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c	2008-08-28 19:37:49 UTC (rev 16290)
+++ branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c	2008-08-28 21:19:25 UTC (rev 16291)
@@ -3447,34 +3447,37 @@
 	uiDefButI(block, NUM, B_DIFF, "Max cut:", 97, -22, 95, 20, &G.scene->r.lightcuts_max_cut, 0, 5000, 0, 0, "The maximum size of the cut (higher values increase rendering times for occluded areas)");
 	uiBlockEndAlign(block);
 	
+	uiDefButI(block, NUM, B_DIFF, "Area lights:", 0, -54, 192, 20, &G.scene->r.lightcuts_area_lights, 0, 100000, 0, 0, "The number of point lights generated for all the area lights");
+
 	uiBlockBeginAlign(block);
-	uiDefButBitI(block, TOG, SCE_PASS_LCFAUX, B_SET_PASS, "False color", 200, 0, 48, 20, &srl->passflag, 0, 0, 0, 0, "(Debug option) Deliver false color pass");
-	uiDefButI(block, NUM, B_DIFF, "Debug:", 200, -22, 48, 20, &G.scene->r.lightcuts_debug_options, 0, 0xffffffff, 0, 0, "(Debug option) Slider to select debug prints");
-	uiDefButBitS(block, TOG, 0x10, B_DIFF, "VPL Mesh", 200, -44, 48, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Creates a mesh to visualize indirect light placement");
-	uiDefButBitS(block, TOG, 0x20, B_DIFF, "No clamp", 200, -66, 48, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Disable clamping mechanism for virtual point lights");
+	uiDefButBitI(block, TOG, 0x8, B_DIFF, "Enable", 0, -86, 62, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Enable environment map lighting");
+	uiDefButS(block, NUM, B_DIFF, "Envmap:", 63, -86, 192-64, 20, &G.scene->r.lightcuts_env_map, 0, 20000, 0, 0, "How many point lights are used to convert the environment map");
+	uiDefButBitI(block, TOG, 0x0040, B_DIFF, "No spec", 0, -108, 62, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Disable specular from environment mapping");
+	uiDefButF(block, NUM, B_DIFF, "Fac:", 63, -108, 192-64, 20, &G.scene->r.lightcuts_env_map_fac, 0.0f, 100.0f, 0, 0, "Intensity of environment map");
 	uiBlockEndAlign(block);
 	
 	uiBlockBeginAlign(block);
-	uiDefButI(block, NUM, B_DIFF, "Area lights:", 0, -54, 192, 20, &G.scene->r.lightcuts_area_lights, 0, 100000, 0, 0, "The number of point lights generated for all the area lights");
-	uiDefButBitS(block, TOG, 0x8, B_DIFF, "Enable", 0, -76, 31, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Enable environment map lighting");
-	uiDefButS(block, NUM, B_DIFF, "Envmap:", 33, -76, 192-33-64, 20, &G.scene->r.lightcuts_env_map, 0, 20000, 0, 0, "How many point lights are used to convert the environment map");
-	uiDefButF(block, NUM, B_DIFF, "Fac:", 128, -76, 64, 20, &G.scene->r.lightcuts_env_map_fac, 0.0f, 100.0f, 0, 0, "Intensity of environment map");
+	uiDefButBitI(block, TOG, 0x2, B_DIFF, "Only", 0, -140, 62, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Render only indirect lighting");
+	uiDefButS(block, NUM, B_DIFF, "Indirect:", 63, -140, 128, 20, &G.scene->r.lightcuts_indirect, 0, 100, 0, 0, "Number of indirect lights per each direct light (currently only from area lights)");
+	/* TODO: yep, magic numbers, but they are going to change soon anyway */
+	uiDefButBitI(block, TOG, 0x0080, B_DIFF, "No spec", 0, -162, 62, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Disable specular from indirect lighting");
+	uiDefButF(block, NUM, B_DIFF, "Fac:", 63, -162, 128, 20, &G.scene->r.lightcuts_indir_fac, 1.0, 100000.0, 0, 0, "Indirect lighting factor");
+	uiDefButBitI(block, TOG, 0x4, B_DIFF, "2nd", 0, -184, 62, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Enable second bounce for indirect lighting");
+	uiDefButF(block, NUM, B_DIFF, "Dist:", 63, -184, 128, 20, &G.scene->r.lightcuts_indir_dist, 0.001, 1000.0, 0, 0, "Distance for indirect lights");
 	uiBlockEndAlign(block);
 	
 	uiBlockBeginAlign(block);
-	uiDefButS(block, NUM, B_DIFF, "Indirect lights:", 0, -108, 192-65, 20, &G.scene->r.lightcuts_indirect, 0, 100, 0, 0, "Number of indirect lights per each direct light (currently only from area lights)");
-	/* TODO: yep, magic numbers, but they are going to change soon anyway */
-	uiDefButBitS(block, TOG, 0x1, B_DIFF, "Fixed", 192-63, -108, 63, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Enable fixed directions for indirect lighting");
-	uiDefButBitS(block, TOG, 0x4, B_DIFF, "2nd", 0, -130, 127, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Enable second bounce for indirect lighting");
-	uiDefButBitS(block, TOG, 0x2, B_DIFF, "Only", 129, -130, 192-129, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "Render only indirect lighting");
-	uiDefButF(block, NUM, B_DIFF, "Indirect fac:", 0, -152, 95, 20, &G.scene->r.lightcuts_indir_fac, 1.0, 100000.0, 0, 0, "Indirect lighting factor");
-	uiDefButF(block, NUM, B_DIFF, "Indirect dist:", 97, -152, 95, 20, &G.scene->r.lightcuts_indir_dist, 0.001, 1000.0, 0, 0, "Distance for indirect lights");
+	uiDefButBitI(block, TOG, SCE_PASS_LCFAUX, B_SET_PASS, "False color", 200, 0, 48, 20, &srl->passflag, 0, 0, 0, 0, "(Debug option) Deliver false color pass");
+	uiDefButI(block, NUM, B_DIFF, "Debug:", 200, -22, 48, 20, &G.scene->r.lightcuts_debug_options, 0, 0xffffffff, 0, 0, "(Debug option) Slider to select debug prints");
+	uiDefButBitI(block, TOG, 0x10, B_DIFF, "VPL Mesh", 200, -44, 48, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Creates a mesh to visualize indirect light placement");
+	uiDefButBitI(block, TOG, 0x20, B_DIFF, "No clamp", 200, -66, 48, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Disable clamping mechanism for virtual point lights");
+	uiDefButBitI(block, TOG, 0x01, B_DIFF, "Fixed", 200, -88, 48, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Enable fixed directions for indirect lighting");
 	uiBlockEndAlign(block);
 	
 	uiBlockBeginAlign(block);
-	uiDefButS(block, ROW, B_DIFF, "R601", 0, -184, 64, 20, &G.scene->r.lightcuts_color_weight, 0, 3, 0, 0, "R601 color weights: 0.299r 0.587g 0.114");
-	uiDefButS(block, ROW, B_DIFF, "Mid", 64, -184, 64, 20, &G.scene->r.lightcuts_color_weight, 0, 1, 0, 0, "Midway color weights: 0.316r 0.460g 0.224g");
-	uiDefButS(block, ROW, B_DIFF, "Even", 128, -184, 64, 20, &G.scene->r.lightcuts_color_weight, 0, 2, 0, 0, "Even color weights: 1/3r 1/3g 1/3b");
+	uiDefButS(block, ROW, B_DIFF, "R601", 200, -120, 48, 20, &G.scene->r.lightcuts_color_weight, 0, 3, 0, 0, "R601 color weights: 0.299r 0.587g 0.114");
+	uiDefButS(block, ROW, B_DIFF, "Mid", 200, -132, 48, 20, &G.scene->r.lightcuts_color_weight, 0, 1, 0, 0, "Midway color weights: 0.316r 0.460g 0.224g");
+	uiDefButS(block, ROW, B_DIFF, "Even", 200, -154, 48, 20, &G.scene->r.lightcuts_color_weight, 0, 2, 0, 0, "Even color weights: 1/3r 1/3g 1/3b");
 	uiBlockEndAlign(block);
 }
 





More information about the Bf-blender-cvs mailing list