Is there a way to have a shader behave differently near a mesh edge?

For example, if a shader generates a checkered pattern, is it possible to detect the edge and make the squares that intersect the edge transparent?

enter image description here

Some clarifications:

  1. The solution can be for a single face. In other words if the edge can be detected on a signle face.
  2. The solution should work even if the face is not a simple shape like a circle, square, or triangle.
  • $\begingroup$ Sorry if my question is silly, but by "make the squares that intersect the edge transparent" in this case do you literally mean you want only the 9 squares in the middle to be opaque while the other ones that intersect the edge fully transparent? Or do you just want a smooth gradient around the edge that can be made transparent? $\endgroup$
    – uvnoob
    Aug 23, 2020 at 19:34
  • $\begingroup$ I want only the 9 squares in the center to be opaque. The squares on that intersect the eve should be transparent. $\endgroup$
    – Ed Tate
    Aug 23, 2020 at 20:23
  • 1
    $\begingroup$ blender.stackexchange.com/questions/114079/… $\endgroup$
    – Ed Tate
    Aug 23, 2020 at 23:25
  • 2
    $\begingroup$ "The solution can be for a single face. In other words if the edge can be detected on a signle face" - you mean a solution would be acceptable if the same shader turns the whole face transparent only if the face has a border edge? If that is the case, would the following work: Script that assigns UV coordinates of (0,0) to faces (their vertices) touching borders, otherwise set UV to (1,1). Then you could easily manipulate every face based on generated UV values. $\endgroup$
    – uvnoob
    Aug 24, 2020 at 7:59
  • $\begingroup$ @uvnoob I agree that this should work. You would need a very dense geometry though $\endgroup$
    – Gorgious
    Aug 24, 2020 at 8:31

2 Answers 2


This might be only an answer that helps to improve the question, but if you subdivide a plane, assign blue material, checker deselect, assign ping material, then create a circle, knife project and remove vertices outside the circle, add a geonodes modifier:

And finally modify the blue material to:

You will get this effect:

Of course this effect could be applied also to pink faces, as well as there could be a single material for both colors, and the color could be captured on faces, or just the shader's checkerboard texture could be aligned with geometry; I did it this way to clearly show it requires the squares to be defined by geometry, as this is how I understand this statement:

The solution can be for a single face. In other words if the edge can be detected on a signle face.

  • $\begingroup$ Though you could also remove those faces in geonodes. $\endgroup$ Apr 18 at 8:57

I'm not at my pc at the moment, so I can't test it, but I can point you in the right direction, I would use a colorramp-node and mask out the dark squares so they are transparent, then use the geometry-node (docs.blender.org/manual/en/latest/render/shader_nodes/input/…) to create a mask for the position, use another colorramp to set the threshold, and then blend between the original and the transparent texture using a mix-node and the factor comes prom the mask. I hope that helps and I'm sorry that I can just be theoretical at the moment. All the best – Marco Vitale

  • $\begingroup$ The challenge that this is part of an animation and I only want to have the dark cell on the edge of the mesh transparent. $\endgroup$
    – Ed Tate
    Feb 27, 2021 at 18:50

You must log in to answer this question.

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