Material °Angle° detection

Trying to create a material where face angles are highlighted, creating this effect:

So far the only solution I can find uses TexCoords (the closer the face is to coords 0 or 1 the brighter it gets), like this:

The issue with this is, of course, that this may work with a simple shape like a cube, but causes issues with almost any other shape:

Does anyone have ideas on alternative approaches to this?

Fresnel (depending on the camera angle) and depth buffer (highlighting just the outline, not the shape) seem to be leading nowhere.

1 Like

I think you can do it with VertexNormal

1 Like

@ClockworkOcean that’s a very smart approach, thanks for the help!

In my use case it doesn’t solve the issue (yet), since by design it works on dense geometry with smooth shading, but definitely a step in the right direction.

1 Like

I seem to recall trying this also, at some point

I don’t think there’s a solution for all cases though.

you could try some standard edge detection algorithms for the front and backfaces. i “solved” the “silhouette edges” in this thread.

1 Like