While debugging some of my occlusion shaders, I've put together simple RIB and SL demonstrating two pass pointcloud based refractions using indirectdiffuse shadeop. It's a pretty old trick but never officially documented for some reason. First off, pointcloud baking shader:
Code:
surface simple_bake
(
uniform float bake = 0;
uniform string ptc_file = "mybake.ptc";
uniform float ptc_interpolate = 0;
uniform float ptc_radiusscale = 1
)
{
normal Nn = normalize( N );
if( bake != 0 )
{
bake3d( ptc_file, "", P, Nn, "_radiosity", Cs, "coordsystem", "world", "interpolate", ptc_interpolate, "radiusscale", ptc_radiusscale );
}
Ci = Cs;
}
Refraction shader
Code:
surface refractive
(
uniform float pointbased = 1;
uniform string ptc_file = "";
uniform string envmap = "";
uniform float blur = 0.1;
uniform float ior = 1.1
)
{
vector In = normalize( I );
normal Nn = normalize( N );
vector Refr = refract ( In, Nn, ior );
Ci = indirectdiffuse( P, Refr, 0,
"pointbased", pointbased,
"filename", ptc_file,
"environmentmap", envmap,
"coneangle", blur,
"clamp",
...