3
$\begingroup$

I am practicing with the creation of various procedurally generated materials and a unique problem has come up for me.

I have looked at a number of tutorials on shader creation and have been searching online for a while now with regards to this specific issue, having found some questions with only tangentially related topics.

I am trying to determine how I can pass the "edge angle" to a shader in cycles.

For example, when one is using the edge split modifier they can specifiy an edge angle that allows them to force the renderer to treat an edge as a non smoothed edge.

What I want to acheive:

I want to find areas of interest with respect to the way that the edge split has chosen these areas. The mesh pictured is smooth shaded, the left is without the edge split modifier applied and the right side has the edge split applied. Red areas show really distinctly, where edge split created a hard edge. The green area highlights where the bevel that was present on this material tester object becomes a much more prominent feature as aresult of the edge split angle. enter image description here

I want to find a shader input that would allow me to say, take places where the edge angle is high as inputs, sortof like you can do with fresnel or other black and white input nodes

I want to do this procedureally, or at very last, I want to avoid using map textures because I want to be able to apply this material to objects that may not have a UV map.

Things I have trie as inputs (Using node wrangler to view the mask):

  • Fresnel / Layerweight: These options apply to whole geometry and ignore specific areas. Furthermore, fresnel is dependant on the viewing angle, not the geometry. That makes the fresnel simply move around the edges at any viewing angle. Fresnel shown via nodewrangler
  • Geometry > Pointiness: This does not work on something that has smooth curves. I have seen it used before in material tutorials but I understand that it relies on point density, something which a test ball (and presumeably many meshes) will not have in great amounts. Pointiness shown via nodewrangler
  • Every option I can think of in most input nodes : I have seen wild techniques about the angling of faces for use in topology like this for example but that only works for meshes where mesh is concave with respect to positive Z (likely would not work with purely vertical faces either)

Things I have not tried but seen as (non optimal) options:

  • Vertex painting a mask: While this is not ideal it would work. Id prefer not doing this because then one has to manually paint each mesh that they intend to use the materials on. I have also seen that most explaining this technique view it as requiring a fairly high detail mesh.

Is there a way I can get the edge angle out of the geometry and use it as an input for cycles shaders?

$\endgroup$
  • $\begingroup$ Have you tried adjusting the Pointiness output with a Color Ramp node? That is usually the only way to go $\endgroup$ – Duarte Farrajota Ramos Jan 10 '18 at 18:21
  • $\begingroup$ That provides a reasonable effect It seems, Better than what I was getting from an un-augmented pointiness mask. I will keep it in mind in case the magical unicorn script guru does not show up. $\endgroup$ – VampyreSix Jan 10 '18 at 18:25
5
$\begingroup$

This solution doesn't give you a perfect angle based control but it is sort of a better version of the pointiness value map.

You will have to download a daily 2.79 build from https://builder.blender.org/download/ to get access to the bevel node.

enter image description here

The viewer node is just an emission shader to view the value map.

enter image description here

You can tweak this map even further with a colorramp node of course.

$\endgroup$
  • $\begingroup$ Will try this once I get back to the machine I use for blender, Looks very promising though! $\endgroup$ – VampyreSix Jan 10 '18 at 19:58
  • 1
    $\begingroup$ This answer works well enough for my needs. I don't feel like trying to dig up the source code and this helped quite a bit. Though it is not angle based, the radius does provide a reasonable approximation for this process. Thank you Bert. $\endgroup$ – VampyreSix Jan 11 '18 at 0:12
  • $\begingroup$ You are very welcome! $\endgroup$ – Bert VdB Jan 11 '18 at 8:20
  • $\begingroup$ I believe there is an addon that can make vertex paint masks based on angles... You could use such a vertex map to mask out a portion of the technique above. $\endgroup$ – Bert VdB Jan 11 '18 at 8:22
  • 1
    $\begingroup$ There is an operator you can call from the spacebar menu within edit mode called 'Select sharp Edges' and lets you select edges based on an angle. This might give you the ability to create a vertex mask based on a given angle. $\endgroup$ – Bert VdB Jan 16 '18 at 10:32

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.