Revision: 16582 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16582 Author: unclezeiv Date: 2008-09-17 23:00:41 +0200 (Wed, 17 Sep 2008)
Log Message: ----------- Added a debug switch ("No rand clus") that disables random selection of lights as cluster representatives. This options is intended for testers to see how it affects flickering in animations. Modified Paths: -------------- 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/render/intern/source/lightcuts.c =================================================================== --- branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-09-17 20:02:20 UTC (rev 16581) +++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-09-17 21:00:41 UTC (rev 16582) @@ -100,6 +100,7 @@ #define LC_OPT_NO_CLAMP 0x0020 #define LC_OPT_ENV_NOSPEC 0x0040 #define LC_OPT_IND_NOSPEC 0x0080 +#define LC_OPT_NO_RAND_CLS 0x0100 #define LC_LAR_INDIRECT 0x01 #define LC_LAR_GENERATED 0x02 @@ -291,12 +292,12 @@ } /* returns 0 if the new cluster uses the first child as representative, 1 otherwise */ -static int add_new_cluster(LightcutsCluster *array, LightcutsClusterPair *minpair, int *root, float *colw) +static int add_new_cluster(LightcutsCluster *array, LightcutsClusterPair *minpair, int *root, float *colw, int random) { LightcutsCluster *one = &array[minpair->first]; LightcutsCluster *two = &array[minpair->second]; LightcutsCluster *dest = &array[*root]; - int rep; + int rep, use_one_as_repr; /* mark children elements as already in tree */ one->in_tree = 1; @@ -324,8 +325,13 @@ if (one->type == CLUSTER_SPOT) dest->cone_angle= get_bounding_cone(one, two, dest->cone_dir); + if (random) + use_one_as_repr= BLI_frand() * (one->luminance + two->luminance) < one->luminance; + else + use_one_as_repr= one->luminance > two->luminance; + /* the representative light is chosen randomly among children */ - if (BLI_frand() * (one->luminance + two->luminance) < one->luminance) { + if (use_one_as_repr) { dest->lar= one->lar; VECCOPY(dest->col, one->col); rep= 0; @@ -711,7 +717,7 @@ /* valid pair: build cluster out of it, mark children as used */ cluster_id = tree->free; - rep= add_new_cluster(array, minpair, &tree->free, lcd->colw); + rep= add_new_cluster(array, minpair, &tree->free, lcd->colw, !(lcd->options & LC_OPT_NO_RAND_CLS)); if (rep==0) { BLI_kdtree_weak_delete(kdtree, minpair->second); Modified: branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c =================================================================== --- branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c 2008-09-17 20:02:20 UTC (rev 16581) +++ branches/soc-2008-unclezeiv/source/blender/src/buttons_scene.c 2008-09-17 21:00:41 UTC (rev 16582) @@ -3473,17 +3473,18 @@ uiBlockEndAlign(block); 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"); - 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"); + uiDefButBitI(block, TOG, 0x100, B_DIFF, "No rand clus", 200, 0, 64, 20, &G.scene->r.lightcuts_options, 0, 0, 0, 0, "(Debug option) Disable random selection of cluster representative"); + uiDefButBitI(block, TOG, SCE_PASS_LCFAUX, B_SET_PASS, "False color", 200, -22, 64, 20, &srl->passflag, 0, 0, 0, 0, "(Debug option) Deliver false color pass"); + uiDefButI(block, NUM, B_DIFF, "Debug:", 200, -44, 64, 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, -66, 64, 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, -88, 64, 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, -110, 64, 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", 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"); + uiDefButS(block, ROW, B_DIFF, "R601", 200, -142, 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", 200, -154, 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", 200, -176, 64, 20, &G.scene->r.lightcuts_color_weight, 0, 2, 0, 0, "Even color weights: 1/3r 1/3g 1/3b"); uiBlockEndAlign(block); } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs