/* This shader computes indirect diffuse and stores it into a point cloud. Created by: Jorge Pimentel - http://blog.jorgepimentel.com to use with 3Delight Attributes: intensity - The intensity of the indirect diffuse calculation samples - number of samples ptcPath - path to the point cloud to be written interpolate - 1 to interpolate, 0 to not interpolate. When set to 1.0, it saves the center of the micro-polygons and not its corners. This is useful for point-based indirect diffuse */ light JPindirectDiffuseLight( float intensity = 1; uniform float samples = 64; string ptcPath =""; float interpolate = 1) { normal Nlight = normalize(Ns); color idd = indirectdiffuse(Ps, Nlight, samples) * intensity; float ray_depth; rayinfo("depth", ray_depth); if (ray_depth == 0) { bake3d( ptcPath, "", Ps, Nlight, "indirectdiffuse", idd, "interpolate", interpolate); } illuminate (Ps + Nlight) { Cl = idd; } }