Forum: Poser - OFFICIAL


Subject: Procedural Caustics Experiment

Iuvenis_Scriptor opened this issue on Jul 06, 2011 · 10 posts


Iuvenis_Scriptor posted Thu, 07 July 2011 at 9:30 PM

This is a bit long, and I might yet be able to streamline the process a bit further, but here's a more detailed look at the experiment for anyone who's interested!

A diagram I found while briefly researching caustics seemed to suggest that they're usually brightest at the edges and center of the incident zone (the lit area) and weakest in the intermediate regions.  Most of the tim spent on the experiment was devoted to finding the right combination of diffuse, specular, and math nodes to create a caustic mask that would match that configuration.  Once I did that, my original plan was to plug the mask into the transparency channel and do a shadows-only render to create a caustic map, which could then be inverted and composited onto a base render.  Unfortunately, due to what I suspect is a flaw in the program, procedural transparency doesn't transfer to shadows.  I kept getting a shadow of the entire cylinder instead of the non-transparent regions.

The process that I eventually dicovered through trial-and-error uses translucence instead.  The caustic mask is plugged into the translucency channel, which is cranked up to 4.8 intensity.  Under most circumstances, this would be a bizarre and useless thing to do.  For caustics, though, it allows the prop to cast a glow on nearby objects, which is exactly what we need.  There is a downside, however: the prop itself is completely blown out (stark black and white).

Luckily, my explorations lead me to stumble upon PP10's "Custom_Output" material channels and the corresponing multi-layer rendering function.  By doing a render of the scene with the caustics shader on the main layer of the cylinder and pure black on the genereted PSD overlay, we get two images that are identical except for the shading of the cylinder.  Compositing the two gives us an image of a completely black cylinder with all the right external shadows and caustics.  For future reference, I'll call this composite the "caustic layer."

Another problem is internal shadows (shadows cast by the illuminated side of the cylinder on its own base), which should be weakened by the refraction and caustics.  To approximate this efffect, I applied the primary glass shader (refraction/reflection/fresnel) and did two renders: one with "Casts shadows" checked on for the cylinder and another with it checked off.  The two were then blended 50/50 in Photoshop to create a shadow with half the normal intensity.  Of course, the external shadows are similarly affected, but they get covered up in the next step anyway.  This composite is the main image.

The final step is to copy/paste the caustic layer on top of the main image, use the Magic Wand tool to highlight the black region, and delete it.  This lets only the refracting/reflecting prop (with dyly weakened internal shadows) show through while everything around it is entirely from the caustic layer.  

Since reflection and refraction often increase render times, I suspect it would be more efficient to just render the fully shaded prop once with "Casts shadows" deactivated, then just reactvivate the shadows and then do a shadows-only render.  I hope to confirm that soon.