Can't convert bevel node output to black/white

(Houndmux) #1

(for some reason my first post didn’t show up, so I’m trying again…)


I want to use the bevel node to create worn edges on a low poly mesh. I use the cross product of bevel and geometry normal to create a mask for a mix shader to simulate metal under chipped paint.
The edges are blurred, so I am trying to use a color ramp to convert the greyscale edges to black/white by setting both color ramp positions to 0.5. But the result is still blurred edges. How can I fix this?

thanks in advance!

(sirmaxim) #2

Someone just did it recently and posted it on reddit:

(Houndmux) #3

Unfortunately the video does not answer my question. It shows how to find edges using the bevel node, but not how to convert the result into an actual 2-color black & white map. The result is always blurred. But a chipped paint effect requires crisp edges, not blurred ones as in “worn edges”.
I found no way to convert the result. Color ramp, even when set to constant, still outputs a blurred transition although it should be 2-color. I also tried splitting the vector, normalizing and all sorts of math nodes, but to no avail. It seems to me like the bevel node outputs weird data which cannot be reasonably processed by other nodes.

(NeOmega) #4

map a noise texture to the displacement. use a color ramp with just black and white, and set the interpolation type to constant. slide the back and white markers towards the center.

PS the bevel node on a low poly object is not recommended, as it completely nullifies the reason for a low poly object, as it is a very expensive shader. better off actually bevelling your high poly object, and then baking the normals to your low poly.

(J_the_Ninja) #5

For actual bevels, sure. But if you want to do some texturing effects without baked curvature/AO, either because you have no UVs, or the required texture would be too large, bevel node can help out a lot there.

But yeah, OP, as NeOmega said, colorramp node with interpolation set to “constant” will do it. The bevel node’s output is always a gradient, so you need to clip the values somehow to get a sharp edge. You can also use a math node set to “greater than” or “less than”. You can also add in some noise prior to that, here’s a worn edge shader I was messing around with:

(NeOmega) #6

Pointiness as your starting geometry may help your warn edge shader.

(J_the_Ninja) #7

Again situational, since pointiness is per-vertex rather than per-pixel.

(Houndmux) #8

It should work and you can convert all other maps like noise etc. to black/white this way, but for some reason, the bevel node’s output seems to ignore it. I tried “color ramp constant”, “greather than”, both togehter, normalized or not, the node output simply doesn’t seem to care.

Here’s a test setup:

and this is the corresponding render:

Blurred edges but they should be purely black&white.

(JonMicheelsen) #9

Here is another solution, that does full convexity - both dark cavity and bright curvature.

It does not need a high poly subdivision, obviously.

I have mapped the bevel radius and convexity contrast to a uv, and set the shader up to show both convexity and normals with a mix node, so I can quickly tweak both at the same time.
Note that what I do is use the bevel nodes result inverse to sharpen the mesh normals beyond what they naturally are, that I then use to drive an ao and inverse ao to combine into the convexity.
Note the turret is a seperate object from the rest, so no bevel/convexity is generated there on purpose.

Edit: Here’s a slightly tweaked one that works better on curved surfaces:

Applying gradient on both sides of every edge on low poly model