|
|
I threw this together this afternoon, based on an old thread by FlyerX.
It doesn't make finding new translucency values any easier, but it might make it
less work from a typing standpoint...
Regards,
A.D.B.
#macro sigma_t_prime(SIGMA_S_PRIME, SIGMA_ALPHA)
#local rVAL = SIGMA_S_PRIME + SIGMA_ALPHA;
rVAL
#end
#macro sigma_tr(SIGMA_ALPHA, SIGMA_T_PRIME)
#local rVAL = sqrt( 3 * SIGMA_ALPHA * SIGMA_T_PRIME );
rVAL
#end
#macro transval(SIGMA_TR)
#local rVAL = 1 / SIGMA_TR;
rVAL
#end
#macro TRANSLUCENCY(SIGMA_P_VEC,SIGMA_A_VEC)
#local SIGMA_T_PRIME = <sigma_t_prime(SIGMA_P_VEC.red, SIGMA_A_VEC.red),
sigma_t_prime(SIGMA_P_VEC.green, SIGMA_A_VEC.green),
sigma_t_prime(SIGMA_P_VEC.blue, SIGMA_A_VEC.blue)>;
#local SIGMA_TR = <sigma_tr(SIGMA_A_VEC.red, SIGMA_T_PRIME.red),
sigma_tr(SIGMA_A_VEC.green, SIGMA_T_PRIME.green),
sigma_tr(SIGMA_A_VEC.blue, SIGMA_T_PRIME.blue)>;
#local TRANSVEC = <transval(SIGMA_TR.red), transval(SIGMA_TR.green),
transval(SIGMA_TR.blue)>;
TRANSVEC
#end
// TRANSLUCENCY BASED ON MEASURED VALUES
// TRANSLUCENCY(SIGMA_S_PRIME, SIGMA_ALPHA)
/*
Values taken from paper "A Practical Model for Subsurface Light Transport"
(Jensen, et. al.)
Stanford University http://graphics.stanford.edu/papers/bssrdf/bssrdf.pdf
*/
// IDEAL REFLECTOR - LAB GRADE (fudged for SIGMA_ALPHA, otherwise the value
would be <inf,inf,inf>)
// #declare SPECTRALON_000 =
TRANSLUCENCY(<11.6000,20.4000,14.9000>,<0.0001,0.0001,0.0001>);
// Naming Convention
// I recommend using 00 indices for values based on this macro, and using
// 1XX indices for experimentally derived values of transparency
#declare APPLE_000 = TRANSLUCENCY(<2.2900,2.3900,1.9700>,
<0.0030,0.0034,0.0460>);
#declare CHICKEN_000 = TRANSLUCENCY(<0.1500,0.2100,0.3800>,
<0.0150,0.0770,0.1900>);
#declare CHICKEN_001 = TRANSLUCENCY(<0.1900,0.2500,0.3200>,
<0.0180,0.0880,0.2000>);
#declare CREAM_000 = TRANSLUCENCY(<7.3800,5.4700,3.1500>,
<0.0002,0.0028,0.0163>);
#declare KETCHUP_000 = TRANSLUCENCY(<0.1800,0.0700,0.0300>,
<0.0610,0.9700,1.4500>);
#declare MARBLE_000 = TRANSLUCENCY(<2.1900,2.6200,3.0000>,
<0.0021,0.0041,0.0071>);
#declare POTATO_000 = TRANSLUCENCY(<0.6800,0.7000,0.5500>,
<0.0024,0.0090,0.1200>);
#declare SKIMMILK_000 = TRANSLUCENCY(<0.7000,1.2200,1.9000>,
<0.0014,0.0025,0.0142>);
#declare SKIN_001_T = TRANSLUCENCY(<0.7400,0.8800,1.0100>,
<0.0320,0.1700,0.4800>);
#declare SKIN_002_T = TRANSLUCENCY(<1.0900,1.5900,1.7900>,
<0.0130,0.0700,0.1450>);
#declare WHOLEMILK_000 = TRANSLUCENCY(<2.5500,3.2100,3.7700>,
<0.0011,0.0024,0.0140>);
// Test printouts for comparison with values obtained by FlyerX p.b-t 17 Jun.
2012
#debug concat("APPLE 1 TRANSLUCENCY: " vstr(3, APPLE_000, ",",0,4) "\n")
#debug concat("CHICKEN 0 TRANSLUCENCY: " vstr(3, CHICKEN_000, ",",0,4) "\n")
#debug concat("CHICKEN 1 TRANSLUCENCY: " vstr(3, CHICKEN_001, ",",0,4) "\n")
#debug concat("CREAM 0 TRANSLUCENCY: " vstr(3, CREAM_000, ",",0,4) "\n")
Post a reply to this message
|
|