I'm working on a cycles shader that requires thickness information, and by that I mean interaction between the mesh with the shader itself and other objects inside it, in a way that as closer a diffuse surface is to the mesh with the shader, the more transparent it is. This is an example of the wanted behaviour: Ignoring the normal map on the surface, as you can see, the closer the white ball is to the blue pillar, the black it is. This image is using Lightwave's thickness node. If one could input it in a Blender Mix Shader factor, it could control transparent/diffuse values on the surface.
Blender apparently doesn't have a proper thickness node, but it has Light Paths... I took a look at light absorption shaders, but those use a B&W MixRGB directly into the color of a Glass shader, I couldn't make it work using as a factor for a Mix shader. Also the fact that we're using transparency instead of glass can be a problem.
Basically this is the situation visualized:
The ray from the camera hits the MixShader Transparent/Diffuse surface, it then travels a certain Depth(D) before it hits another Diffuse Surface, then bounces back through the Mix surface and to the light source. If the Depth travelled is equal or greater than D, the surface is 100% diffuse, otherwise it is a blend until D=0 where transparency is 100%.
Fortunately we have a Transparent Depth Light Path node that can be used, but I'm not knowledgeable enough to understand the math behind it. If you feed Transparency Depth directly into a Mix Shader, the result is almost good, except it is inverted (greater distance = more transparent), and it doesn't work if you flip the shaders on the Mix Shader, or if you multiply it by -1: The left object kinda works (but inverted), the right object doesn't but firstly I'd be glad if even the left worked rightly.
So, is there someone with any idea how to make a thickness node on blender? This is the file if anyone is interested: