If you color ramp the Facing output of a Layer Weight node, you can make a mask of faces at glancing angles. This can be used as a material based silhouette mask for effects, or directly as line art.

Here is a curve beveled into a cylinder showing the effect working pretty nicely. enter image description here

However, the effect doesn't work so well on larger faces, such as the sides of a cube, or down the length of this cylinder. In those cases, it shades the whole surface because it is all the same normal facing. I am trying to find a way around this problem. enter image description here

I learned from this question that it is possible to use UVs and vector math to get a curve's direction. It seems it should be possible then to either use a similar method to get the silhouette of the curve, or use it to mask out of the Layerweight along the curve, or something along those lines. But I'm not strong enough on my vector math to figure out what needs to be done to make this work.

Anyone tried something like this before, or know what to do? Of course, it will only work on curve objects.

  • $\begingroup$ have you tried this solutions? blender.stackexchange.com/questions/562/… $\endgroup$ – MCunha Oct 24 '17 at 18:52
  • $\begingroup$ @MCunha I am familiar with all the methods in that answer, but the goal here is not to get any form of contour outlining. I'm specifically trying to do it with vector math so that it can be done in the material. $\endgroup$ – Ascalon Oct 24 '17 at 23:47

The solution is to calculate the crossproduct of the incoming and curve direction vectors. The absolute of the dotproduct of that and the normal is the facing which you can connect up to your color ramp. enter image description here

enter image description here

  • $\begingroup$ This is the right sort of thing. It seems we've created an effect similar to color ramping layer weight, but via a different method. So this answer is correct, but it looks like I may not be able to use it for the artistic effect I wanted. $\endgroup$ – Ascalon Oct 27 '17 at 4:06
  • $\begingroup$ To clarify, what I wanted to do artistically was to remove the area down the middle when viewed from any angle (don't care what the end caps do though) $\endgroup$ – Ascalon Oct 27 '17 at 4:46

First of all yes i know this answer is not a shader solution.
Neither do i know how deeply you know blender.

So I was puzzling for a while, as i gave a solution for the linked article as well. Though then i realized maybe you just want to have such an effect for some production goal. And how to get there isn't that important, maybe you just want to have outliner effect on technical drawings for example. As that's a very common usage of the effect you want.

If something like that is indeed the case be aware that there is another way to achieve contour lines, its possible to create it using the most basic freestyle line shown below :

(And if you would like to have a little bit more detail then just add silhouette.)

(and if you want to hide any feature of shape then make it emmision as i described in the article you linked)

enter image description here

  • $\begingroup$ Thank you, but as I have said in other comments, I am specifically trying to figure this out in the context of vector math on curves. It matters for the production goal. Freestyle is very limited and can't be accessed within the material. $\endgroup$ – Ascalon Oct 25 '17 at 21:21
  • $\begingroup$ Ok i understand, i'll puzzle some more then $\endgroup$ – user613326 Oct 25 '17 at 21:59

Yeah, you want send the View Vector from a Camera Data node into the Normal input on your shaders.

View Vector

I added Subsurf to soften it a bit. Object masks often do better if they don't cut off suddenly, so that was the thought there. You can tweak that if you want.


You may decide you don't need Glossy.
I thought it looked decent, but it might not be needed for your purposes.

Hope that's what you were going for. Lemme know what'cha think.

  • 3
    $\begingroup$ I'm afraid I don't understand what this is doing at all, or what it has to do with the question. $\endgroup$ – Ascalon Oct 23 '17 at 19:19
  • $\begingroup$ You're trying to make a black & white mask to outline objects for use in something like Photoshop or Gimp, right? $\endgroup$ – Doyousketch2 Oct 24 '17 at 19:43
  • 1
    $\begingroup$ No, I'm trying to make a mask down the length of a curve object $\endgroup$ – Ascalon Oct 24 '17 at 23:45
  • $\begingroup$ To only get light on the curved surface, and nothing on the flat side? $\endgroup$ – Doyousketch2 Oct 25 '17 at 10:34
  • 1
    $\begingroup$ No, it isn't to do with shading at all. This is to make a mask based off angle of normals, minus some areas based on curve direction. $\endgroup$ – Ascalon Oct 25 '17 at 20:36

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.