7
$\begingroup$

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.

The cube is transparent all except for the black border. But actually I want only the (currently black) border to be transparent.

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:

A brick wall made with a particle system

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.

See an example of RenderMan's displacement here.

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.

$\endgroup$
  • $\begingroup$ It's hard to tell what you are after, maybe use a layer weight node instead of a ramp. i.stack.imgur.com/ae0tE.png $\endgroup$ – cegaton Jun 15 '15 at 16:41
  • $\begingroup$ I tried. There are problems with that. 1. Unpredictable behavior when the camera/viewport is moved. 2. Cannot be made full contrast black-and-white for use as a mask. It's always too light or too dark. And there's a problem with using Ray Length too: If an object has parts of its geometry that occlude other parts, an extremely dark area shows up. I've concluded that Layer Weight / Fresnel are not good for making an "outline shader" because the appearance is so heavily influenced by the camera. $\endgroup$ – Mentalist Jun 16 '15 at 14:53
  • $\begingroup$ If what you are looking for is a mask then just invert in the compositor. $\endgroup$ – cegaton Jun 16 '15 at 15:08
  • $\begingroup$ Would simply inverting the stoppers of the colour ramp be what you are looking for? $\endgroup$ – Hexbob6 Jul 6 '15 at 12:32
  • $\begingroup$ Does swapping the sockets on the mix node do what you want? The reason that reversing the swatches on the color ramp doesn't work is because that the ray length has values greater than 1 which the color ramp is clamping to 1. You could use an invert node after the color ramp too. $\endgroup$ – PGmath Oct 8 '15 at 2:11
1
$\begingroup$

True surface displacement can be achieved with tessellation and a Displace modifier.

There is also a new Experimental Cycles Displacement node, but since it isn't continuous across face boundaries, it creates gaps between faces.

Cycles - What is the expected range of values for Displacement?

$\endgroup$
  • $\begingroup$ Thanks, yeah it's really too bad about the gaps between faces. I hope the devs keep working on the feature and get it to a usable state. I wonder why those gaps appear when the Displace Modifier doesn't have that problem. $\endgroup$ – Mentalist Jul 5 '16 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.