To show edges of geometry in render like on your screenshot I used Freestyle, i.e. it's possible to see the result only when rendering (either in Preview / Viewport render or scene render).
In Render Layers tab, Freestyle Line Set rollout I set up 3 freestyle layers:
- one for border edges of meshes (
contours
);
- one for hidden geometry (i.e. the one which is hidden from viewer with another geometry) (
seeing-through
)
- and one for foreground edges (i.e. ones that are closer to the camera and are visible) (
foreground
).
contours
layer (thick grey line):
Has the simplest setup, nearly default one (it has Suggestive Contours checked and that's not needed for it to work).
seeing-through
layer (dashed green line):
I checked Hidden option to make hidden geomtry selected by Fresstyle. I unchecked all the options from Edge Types category (it will also work if checking default ones and Crease, which will work only if its angle is set, see below).
foreground
layer (thin red line):
Only Crease is checked because layer is intended to show those edges which are neither borders nor contours and at the same time aren't hidden geometry. In order to make it work Crease Angle in Freestyle rollout in the same tab is set to 120 degrees instead of default 0:
I also changed line style for every layer, like thickness, color etc. in Freestyle Line Style rollout in the same tab.
The result:
It has some inaccuracies, like the one with the top red edge of the rightmost cube, it stops being visible and becomes hidden too early (it should've been red all the way up to cylinder). If this is something visible for you and not desired, it should be possible to avoid that if subdividing that edge with a loopcut.