This is an alternative way to set up edge rendering in Cycles. It is meant as an accompaniment to Blender Internal Engine Edge and Freestyle rendering options. This method uses object and/or material ID passes to create masks which, when combined, define an object or material outline.
I have a project with several criteria I wanted to meet.
- I only wanted edges to appear around specific objects in the scene.
- I wanted to be able to control the width of the edges as well as the color.
- I wanted to be able to easily turn the edge render option on and off.
- I wanted to use Cycles as the render engine.
One way to do this of course is to use the Edge or Freestyle options of the Internal Render Engine to render out layer passes for just the edge conditions. That is how the warthog closeup picture on this page was made. It quickly became cumbersome to render layer passes in both Cycles and the Internal Render engines and composite them back together to meet all of my goals, however. After a lot of searching and experimentation the following compositing node setup works for my purposes:
In the following image the cube and the cone have different object index numbers which allowed me to specify separate outline conditions. The node setups for each object are combined via an Alpha Over node which connects to the Composite Out node. A limitation of this technique can be seen on the cube. An outline is rendered for all the visible edges:
In this image The sphere and cube have the same object id number. There is no edge distinction between them where they overlap:
A material index pass allowed me to further distinguish the sphere from the cube in the next image. The complete composite nodes setup is also provided: