Coefficients and colors from d'Eon and Luebke skin scattering work
ScatterCoeffs
0.0064, 0.0484, 0.187, 0.567, 1.99, 7.41
Sqrt
2
ScatterColors
0.233, 0.455, 0.649
,
0.1, 0.336, 0.344
,
0.118, 0.198, 0
,
0.113, 0.007, 0.007
,
0.358, 0.004, 0
,
0.078, 0, 0
GaussianFn
var_, x_
:
1
Sqrt
2
Pi
var
Exp
x
x
2
var
Skin scattering profile approximated a sum of multiplegaussians. We don't want to work with three
dimensional RGBvectors so here one of the inputs selects which channel we want
ScatterFn
x_, rgb_
:
Apply
Plus, Table
GaussianFn
var, x
,
var, ScatterCoeffs
ScatterColors
rgb
Out[1]=
0.00905097, 0.0684479, 0.264458, 0.801859, 2.81428, 10.4793
Out[2]=
0.233, 0.455, 0.649
,
0.1, 0.336, 0.344
,
0.118, 0.198, 0
,
0.113, 0.007, 0.007
,
0.358, 0.004, 0
,
0.078, 0, 0
In[5]:=
This is the function defined with integrals, as in the paper
DiffuseLight
Θ
_, r_, rgb_
:
NIntegrate
Clip
Cos
Θ
x
,
0, 1
ScatterFn
Abs
2
r
Sin
x
2
, rgb
,
x,
Pi, Pi
DiffuseWeight
r_, rgb_
:
NIntegrate
ScatterFn
Abs
2
r
Sin
x
2
, rgb
,
x,
Pi, Pi
DiffuseIntegral
Θ
_, r_, rgb_
:
DiffuseLight
Θ
, r, rgb
DiffuseWeight
r, rgb
This is a bit faster to evaluate,it's a translation of the code used to generate the lookup table
DiffuseWeight2
r_, rgb_
:
NSum
ScatterFn
Abs
2
r
Sin
x
2
, rgb
,
x,
Pi, Pi, 2
Pi
20
DiffuseLight2
Θ
_, r_, rgb_
:
NSum
Clip
Cos
Θ
x
,
0, 1
ScatterFn
Abs
2
r
Sin
x
2
, rgb
,
x,
Pi, Pi, 2
Pi
20
DiffuseIntegral2
Θ
_, r_, rgb_
:
DiffuseLight2
Θ
, r, rgb
DiffuseWeight2
r, rgb
In[11]:=
Let's theck that they are similar...
DiffuseIntegral
0.1, 8, 1
DiffuseIntegral2
0.1, 8, 1
DiffuseIntegral
0.1, 15, 1
DiffuseIntegral2
0.1, 15, 1
Out[11]=
0.979266
Out[12]=
0.990889
Out[13]=
0.990641
Out[14]=
0.994601
In[16]:=
Let's generate a table of data to be used for the numerical fitting...
channel
1;
1
red 2
green 3
blue
dataThetaRVal
Flatten
Table
Θ
, r, DiffuseIntegral
Θ
, r, channel
,
Θ
, 0, Pi, 2
Pi
20
,
r, 0.25, 6, 1
20
, 1
;