[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58253] branches/soc-2013-dingto/intern/ cycles: Cycles / Blackbody node:
Thomas Dinges
blender at dingto.org
Mon Jul 15 06:38:39 CEST 2013
Revision: 58253
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58253
Author: dingto
Date: 2013-07-15 04:38:35 +0000 (Mon, 15 Jul 2013)
Log Message:
-----------
Cycles / Blackbody node:
* Fix the weird results with 800-804.3 Kelvin in SVM. This was an offset issue with the lookup table, made the table slightly larger now (from 954 to 956) which gives a small gap between the R/G/B components.
* Use Luminance also for values below 800 Kelvin, for consistency.
Modified Paths:
--------------
branches/soc-2013-dingto/intern/cycles/kernel/svm/svm_blackbody.h
branches/soc-2013-dingto/intern/cycles/render/blackbody.cpp
Modified: branches/soc-2013-dingto/intern/cycles/kernel/svm/svm_blackbody.h
===================================================================
--- branches/soc-2013-dingto/intern/cycles/kernel/svm/svm_blackbody.h 2013-07-15 03:54:57 UTC (rev 58252)
+++ branches/soc-2013-dingto/intern/cycles/kernel/svm/svm_blackbody.h 2013-07-15 04:38:35 UTC (rev 58253)
@@ -47,9 +47,9 @@
color_rgb = make_float3(1.0e-6f,0.0f,0.0f);
}
else if (temperature <= BB_MAX_TABLE_RANGE) {
- /* This is the overall size of the table (317*3+3) */
- const int lookuptablesize = 954;
- const float lookuptablesizef = 954.0f;
+ /* This is the overall size of the table */
+ const int lookuptablesize = 956;
+ const float lookuptablesizef = 956.0f;
/* reconstruct a proper index for the table lookup, compared to OSL we don't look up two colors
just one (the OSL-lerp is also automatically done for us by "lookup_table_read") */
@@ -60,21 +60,21 @@
/* Retrieve colors from the lookup table */
float lutval = t/lookuptablesizef;
float R = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize);
- lutval = (t + 317.0f*1.0f)/lookuptablesizef;
+ lutval = (t + 319.0f*1.0f)/lookuptablesizef;
float G = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize);
- lutval = (t + 317.0f*2.0f)/lookuptablesizef;
+ lutval = (t + 319.0f*2.0f)/lookuptablesizef;
float B = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize);
R = powf(R, BB_TABLE_YPOWER);
G = powf(G, BB_TABLE_YPOWER);
B = powf(B, BB_TABLE_YPOWER);
- /* Luminance */
- float l = linear_rgb_to_gray(make_float3(R, G, B));
-
color_rgb = make_float3(R, G, B);
- color_rgb /= l;
}
+
+ /* Luminance */
+ float l = linear_rgb_to_gray(color_rgb);
+ color_rgb /= l;
if (stack_valid(col_offset))
stack_store_float3(stack, col_offset, color_rgb);
Modified: branches/soc-2013-dingto/intern/cycles/render/blackbody.cpp
===================================================================
--- branches/soc-2013-dingto/intern/cycles/render/blackbody.cpp 2013-07-15 03:54:57 UTC (rev 58252)
+++ branches/soc-2013-dingto/intern/cycles/render/blackbody.cpp 2013-07-15 04:38:35 UTC (rev 58253)
@@ -93,8 +93,8 @@
// h is Planck's const, k is Boltzmann's
const float dlambda = 5.0f * 1e-9; // in meters
- /* Blackbody table from 800 to 12k Kelvin (317 entries) */
- vector<float> blackbody_table(317*3+3);
+ /* Blackbody table from 800 to 12k Kelvin (319 entries (317+2 offset) * 3) */
+ vector<float> blackbody_table(956);
float X, Y, Z;
@@ -131,8 +131,8 @@
/* Store in table in RRRGGGBBB format */
blackbody_table[i] = col.x;
- blackbody_table[i+317*1] = col.y;
- blackbody_table[i+317*2] = col.z;
+ blackbody_table[i+319*1] = col.y;
+ blackbody_table[i+319*2] = col.z;
}
return blackbody_table;
More information about the Bf-blender-cvs
mailing list