5
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – Nicola Sap
    Jun 8, 2017 at 6:59
  • $\begingroup$ 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. $\endgroup$
    – Sum-Al
    Jun 8, 2017 at 7:05
  • $\begingroup$ 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... $\endgroup$
    – m.ardito
    Jun 8, 2017 at 9:05
  • $\begingroup$ Possible duplicate of: How to render a mesh transparent with a color on its edges only, with nodes? $\endgroup$
    – user1853
    Jun 8, 2017 at 14:37

1 Answer 1

1
$\begingroup$

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).

Transparent object, shaded wireframe

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.

$\endgroup$
4
  • $\begingroup$ Duplicating is a good idea. I'll check if something can be done like that. $\endgroup$
    – Sum-Al
    Jun 8, 2017 at 11:17
  • $\begingroup$ 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. $\endgroup$
    – Nicola Sap
    Jun 8, 2017 at 11:25
  • $\begingroup$ 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? $\endgroup$
    – Sum-Al
    Jun 8, 2017 at 14:05
  • $\begingroup$ Yes, any other topology which is not at the borders but that sharply points towards the camera would be sketched $\endgroup$
    – Nicola Sap
    Jun 8, 2017 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .