Revision: 15141
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15141
Author:   unclezeiv
Date:     2008-06-06 00:40:26 +0200 (Fri, 06 Jun 2008)

Log Message:
-----------
Using luminance instead of lamp intensity (energy) at all levels. Calculations 
should be more accurate, but I have seen little to no difference in my tests.

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-06-05 22:18:13 UTC (rev 15140)
+++ branches/soc-2008-unclezeiv/source/blender/render/intern/source/lightcuts.c 
2008-06-05 22:40:26 UTC (rev 15141)
@@ -61,6 +61,7 @@
        float min[3];
        float max[3];
        float col[3];
+       float luminance;
        LampRen * lar;
 } LightcutsCluster;
 
@@ -116,7 +117,7 @@
        
        VECSUB(diff, max, min);
        
-       return (one->intensity + two->intensity) * VEC_LEN_SQ(diff);
+       return (one->luminance + two->luminance) * VEC_LEN_SQ(diff);
 }
 
 static void add_new_cluster(LightcutsCluster * array, LightcutsClusterPair * 
minpair, int * root)
@@ -134,7 +135,7 @@
        dest->id = *root;
        dest->child1 = minpair->first;
        dest->child2 = minpair->second;
-       dest->intensity = one->intensity + two->intensity;
+       dest->luminance = one->luminance + two->luminance;
        
        /* compute new bounding box */
        VECCOPY(dest->min, one->min);
@@ -143,7 +144,7 @@
        DO_MINMAX(two->max, dest->min, dest->max);
        
        /* the representative light is chosen randomly among children */
-       if (BLI_frand() * (one->intensity + two->intensity) < one->intensity) {
+       if (BLI_frand() * (one->luminance + two->luminance) < one->luminance) {
                dest->lar= one->lar;
                VECCOPY(dest->col, one->col);
        }
@@ -151,6 +152,7 @@
                dest->lar= two->lar;
                VECCOPY(dest->col, two->col);
        }
+       dest->intensity= dest->luminance / LC_LUMINOSITY(dest->col);
        
        (*root)++;
 }
@@ -225,6 +227,7 @@
                clus->col[0]= lar->r / lar->energy;
                clus->col[1]= lar->g / lar->energy;
                clus->col[2]= lar->b / lar->energy;
+               clus->luminance= LC_LUMINOSITY(clus->col) * lar->energy;
                
                clus++;
                lcd->free_local++;
@@ -237,7 +240,7 @@
        int i;
        for (i = 0; i < lev; i++)
                printf("-");
-       printf(" id %d, int %f\n", el->id, el->intensity);
+       printf(" id %d, int %f, lum %f\n", el->id, el->intensity, 
el->luminance);
        
        if (el->child1 == 0 && el->child2 == 0)
                return;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to