# Rendering transparent body and opaque edges

I want to create a material for an object such that the body is semi-transparent and only the border of the object is opaque or darker. Is it possible to develop a shader for this ? Or do we have to do through only compositing?

• If you want to have the edges shaded and not the faces, maybe you should consider applying a modifier to the mesh: wireframe modifier, then applying the material normally. Jun 8 '17 at 6:59
• I don't want all the interior edges to be visible either. Just the outermost edges (borders of the object) to be dark and rest of the object to be semi-transparent. Jun 8 '17 at 7:05
• although "the border" is a fuzzy concept in 3d meshes, blender has freestyle that can render edges in a lot of ways, but it uses "linestyles" fro them, not regular "materials" as you could define for regular rendering... Jun 8 '17 at 9:05
• Possible duplicate of: How to render a mesh transparent with a color on its edges only, with nodes?
– user1853
Jun 8 '17 at 14:37

Edit: I understand that the question might actually be about the visual borders of the object (the ones usually highlighted using the freestyle pass), not the edges of the mesh.

I'll however leave my (unfitting) answer below in case somebody else is looking for a solution more similar to this.

A solution could be duplicating your object, then:

• assigning a transparent material to copy #1 (the greenish material in my example)

• for copy #2, using a wireframe modifier and applying the material shown in the nodes setup below, which mixes a full white transparency and a diffuse shader, using the "Transparent depth" input as a mixing factor.

As you can see, back edges are hidden in this setup. You can display them by simply using a diffuse shader (i.e. bypassing the mix shader).

Be aware that this won't work if the object is seen through another transparent object: all the wires will be hidden in this case.

• Duplicating is a good idea. I'll check if something can be done like that. Jun 8 '17 at 11:17
• A workaround solution for shading only the borders could be using only one mesh (it needs to be highly subdivided!) and a material made of a mixer shader with: {Top shader: transparent} {Bottom shader: diffuse} {Fac: Fresnel, IOR = 1.03}. This will shade only those faces that are almost perpendicular to the line of sight. Jun 8 '17 at 11:25
• This would work under the assumption that only the faces close to borders are almost perpendicular to the line of sight right, if I understood your idea correctly? Jun 8 '17 at 14:05
• Yes, any other topology which is not at the borders but that sharply points towards the camera would be sketched Jun 8 '17 at 14:46