Using Ray Length I can make the center of a cube hollow. But what I actually want is the inverse - for the outline to be transparent and the inside solid. At a glance it seems this would be a matter of inverting the color, but since Ray Length uses the transparency to calculate this to begin with, inverting it short-circuits the signal flow and all transparency is removed.
Things I've tried that didn't work:
- Normal node
- Ray Depth
- OSL edge shader (very cool, but doesn't leave the center hollow)
- Cycles Matcap technique
- Each output of the Camera Data node
- All of the above run through various combinations of Color Ramp, RGB Curves, etc.
I would really like for this to work as a Cycles material, rather than relying on compositing. I also would like to avoid solutions that involve Freestyle lines. Those approaches are good for some cases, but in this case I'd like a material that can be brought into any .blend and "just work" on its own.
Any ideas? Thanks.
2016 Feb. Edit:
Since it seems this question is still getting some attention, and because I hadn't explained what the desired end result was, I thought I should add a little more info here.
My hope with this was to achieve an effect that can be used on textures such as brick walls, so that a wall's corners have transparency in the areas between the bricks. With a bump map you can generate shading that makes the bricks appear pushed out, but when it comes to corners the lack of transparency between bricks is a dead giveaway that there is no real geometry.
I have since switched to using particle systems for bricks and I think this is a more effective approach:
While this is a solution for bricks, it is not a universal solution for getting around-corners transparency from displaced textures. Also, geometry-based solutions tend to be more computationally heavy. Subdividing the wall a million times and then throwing a displace Modifier on is not usually practical.
So what is the solution that will work for all textures? I believe RenderMan's displacement, which creates raised geometry from a shader... is the solution.
Anyway, this is the sort of effect I was after, and hoping I could fake something close by first creating a shader with transparent borders. At the time I posted this question I was not aware of RenderMan's displacement feature. And of course, it would be nice to have this in Cycles too... we will see what the future holds.