[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17177] branches/soc-2008-unclezeiv/source /blender/render/intern/source/lightcuts.c: Fixes:
Davide Vercelli
davide.vercelli at gmail.com
Wed Oct 22 16:03:25 CEST 2008
Revision: 17177
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17177
Author: unclezeiv
Date: 2008-10-22 16:03:24 +0200 (Wed, 22 Oct 2008)
Log Message:
-----------
Fixes:
- in rev. 17154 tweaked a parameter in the wrong place. This led to wrong indirect lighting calculations.
- also reverted tweaks in lightcuts metric made in the same revision, as the new metric would hang tree building on some scenes. Further investigation is needed here.
Modified Paths:
--------------
branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.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-10-22 13:20:30 UTC (rev 17176)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 2008-10-22 14:03:24 UTC (rev 17177)
@@ -347,8 +347,11 @@
if (one->type == CLUSTER_SPOT) {
float cos_a= get_bounding_cone_cos(NULL, one, two);
- /* TODO: maybe export sine directly ? */
- float term = cos_a < 0.0f ? 1.0 : (1.0f - cos_a * cos_a);
+ float term = (1.0f - cos_a) * (1.0f - cos_a);
+ /*
+ * TODO: metric suggested in "Fast agglomerative clustering" hangs sponza scene, investigate
+ * float term = cos_a < 0.0f ? 1.0 : (1.0f - cos_a * cos_a);
+ */
return (one->luminance + two->luminance) * (VEC_LEN_SQ(diff) + csq * term);
}
@@ -828,7 +831,7 @@
/* this one uses "fast agglomerative clustering" */
static int lightcuts_build_tree3(LightcutsData *lcd, int tree_index)
{
- float c= lcd->scene_diag * lcd->scene_diag;
+ float c= lcd->scene_diag * lcd->scene_diag / 256.0f;
LightcutsTree *tree= &lcd->trees[tree_index];
LightcutsCluster *array= tree->array;
int clus_a, clus_b, clus_c, rep, stop= 0, cluster_id= 0, remaining;
@@ -863,8 +866,8 @@
clus_c = find_new_min(kdtree, nearest, &data, clus_b);
if (clus_a == clus_c
+ /* TODO: this can be optimized away, the calculations are already performed elsewhere */
|| (lightcuts_compute_metric(c, &array[clus_a], &array[clus_b]) == lightcuts_compute_metric(c, &array[clus_a], &array[clus_c])))
- /* temporary code */
{
cluster_id= tree->free;
rep= add_new_cluster(lcd, array, clus_a, clus_b, &tree->free);
@@ -1905,7 +1908,7 @@
lcd->do_indir= re->r.lightcuts_indirect;
lcd->options= re->r.lightcuts_options;
lcd->error_rate= re->r.lightcuts_max_error;
- lcd->scene_diag= RE_ray_tree_max_size(re->raytree) / 16;
+ lcd->scene_diag= RE_ray_tree_max_size(re->raytree);
lcd->test_break= re->test_break;
#ifdef LIGHTCUTS_DEBUG
lcd->dbg_options= re->r.lightcuts_debug_options;
More information about the Bf-blender-cvs
mailing list