3delight ptc workflow from 3delight forum

volume
ptc_surface_bake(
string ptc_file = "";
string ptc_coordsys = "world";
float i_Ci=3;
float bleeding_intensity = 0.25;
)
{
color aov_incandescence = 0;
color aov_surface_color = 0;
color Ci=0;
surface("aov_surface_color", aov_surface_color);
surface("aov_incandescence", aov_incandescence);
surface("Ci", Ci);

color color_indirect = Oi * aov_incandescence + (aov_surface_color * bleeding_intensity)+(Ci*i_Ci);

bake3d( ptc_file, "", P, N,
"coordsystem", ptc_coordsys,
"surface_color", color_indirect,
"interpolate", 1 );

Ci = Ci;
}

#pragma annotation ptc_sortbleeding "gadgettype=checkbox:0:1=custom value;"
#pragma annotation ptc_clamp "gadgettype=checkbox:0:1=custom value;"
#pragma annotation bake_ptc "gadgettype=checkbox:0:1=custom value;"
#pragma annotation ao_ptc "gadgettype=checkbox:0:1=custom value;"

volume
ptc_surface_bleeding(
string ptc_map = "";
string coordsyst = "world";
string envmap = "";
string envspace = "world";
string ptc_sides = "both";
float ptc_clamp = 1;
float ptc_sortbleeding = 1;
float ptc_bias = 0.045;
float ptc_maxdist = 1e15;
float ptc_coneangle = 180;
float ptc_maxsolidangle = .2;
float ptc_samplebase = 0;

float ptc_falloffmode = 0;
float ptc_falloff = 0;

float rad_intensity = 1;
float ao_ptc = 0;
float ao_coneangle = 180;
float ao_maxdist = 0.5;
float ao_bias=0.045;
float ao_maxsolidangle=0.2;
float ao_falloff=3;
float ao_falloffmode=1;
float bake_ptc = 0;
string ptc_bake_Ci ="";
output varying color aov_ambient = 0;
output varying color aov_envcolor = 0;
output varying color aov_occlusion = 1;
)
{
normal aov_camera_space_normal = 0;
surface("aov_camera_space_normal", aov_camera_space_normal);

color aov_surface_color = 0;
surface("aov_surface_color", aov_surface_color);

float occlusion = 0;

aov_ambient = indirectdiffuse(P, aov_camera_space_normal, 0, "pointbased", 1,
"filename", ptc_map,
"hitsides", ptc_sides,
"coneangle", ptc_coneangle,
"clamp", ptc_clamp,
"coordsystem", coordsyst,
"sortbleeding", ptc_sortbleeding,
"maxdist", ptc_maxdist,
"falloff", ptc_falloff,
"falloffmode", ptc_falloffmode,
"samplebase", ptc_samplebase,
"bias", ptc_bias,
"maxsolidangle", ptc_maxsolidangle,
"environmentmap", envmap,
"environmentspace", envspace,
"environmentcolor", aov_envcolor)*rad_intensity;

 

if(ao_ptc==1){
aov_occlusion = 1-occlusion(P, aov_camera_space_normal, 0, "pointbased", 1,
"filename", ptc_map,
"hitsides", ptc_sides,
"coneangle", ao_coneangle,
"clamp", ptc_clamp,
"coordsystem", coordsyst,
"maxdist", ao_maxdist,
"bias", ao_bias,
"maxsolidangle", ao_maxsolidangle,
"falloff", ao_falloff,
"falloffmode", ao_falloffmode);
}

 

Ci += aov_ambient * aov_surface_color * aov_occlusion;

 

if(bake_ptc == 1){
bake3d( ptc_bake_Ci, "", P, aov_camera_space_normal,
"coordsystem", coordsyst,
"surface_color", Ci,
"_radiosity", aov_ambient,
"interpolate", 1 );
}

}

 

volume brikmap_read(
string map = "";
output varying color aov_ambient = 0;
)
{

color aov_surface_color = 0;
surface("aov_surface_color", aov_surface_color);

color res =0;
texture3d(map, P, N, "_radiosity", res);
aov_ambient = res;
Ci+= res*aov_surface_color;
}

from http://www.alessandrodallafontana.com/pages/wip_mall.htm
posted @ 2009-12-19 12:25  rdRaod  阅读(634)  评论(0编辑  收藏  举报