I am usign this shader to try to bake the subsurface:
volume ptc_bake2(
string ptc_file = "default.ptc";
string ptc_coordsys = "world";
)
{
uniform string raytype = "unknown";
rayinfo("type",raytype);
normal Nf = faceforward( normalize(N), I );
if(raytype != "subsurface")
{
bake3d(ptc_file,"",P,Nf,"coordsystem",ptc_coordsys,
"_sss",Ci,"radiusscale",1.5,"interpolate",1);
}
}
I am not sure if this bake shader is correct.
If it is correct I need to write another shader to render the baked
file with the subsurface shadeop. But I am getting errors:
surface ptc_subsurface(
float Ks = .7, Kd = .6, Ka = .1, roughness = .04;
string ptc_file = "default.ptc";
float biasValue = 0.1;
float clampValue = 0;
string hitsidesValue = "both";
float samplebaseValue = 1;
float maxdistValue = 0;
float maxsolidangleValue = 0.5; )
{
normal Nn = normalize(N);
normal Nf = faceforward(Nn, I);
vector V = normalize(-I);
uniform string raytype = "unknown";
rayinfo( "type", raytype );
if( raytype == "subsurface" )
{
Ci = Ka*ambient() + Kd*diffuse(Nn);
}
else
{
Ci = 1 - subsurface( P,
"filename", ptc_file, "pointbased", 1,
"bias", biasValue, "clamp", clampValue, "hitsides", "both",
"samplebase", 1 ,
"maxdist", maxdistValue, "maxsolidangle", maxsolidangleValue ) + Ks
* specular(Nf, V, roughness);
}
}