Other ways to detect edges?

I am currently trying to create a felt/ wool material that will be used for multiple things. I managed to make it look and work great on a normal sphere but the problem here is that the Fresnel node doesn’t work great with bigger planes or meshes.

This is what it looks like on a sphere:

This is what it looks like on more square objects with less vertices:

Basically what it does currently is making the entire mesh invisible instead of making the edges fuzzy like the sphere.

This is my current setup for the opacity mask:

Is there a better way of detecting an edge and masking it than the Fresnel node?

the fresnel will detect the angle or the face, so it won’t work with a flat plane.
You could use distance fields to blend edges

How does Distance field work? Could you help me out with the set up? I looked into it a bit and there seems to be a lot of different once, what is the difference between these?

Distance fields detect if objects are near each other. This is returned as a black and white representation of the distance on the mesh (can be visualized). You can use this to blend between objects and other effects.

This doesn’t seem like it’s exactly what I want from what I can tell. I don’t want it to be based on the position at all nor the distance to other objects. I just want to get the edges of a mesh and mask them out.

This did however give me ideas for other things!



You could use vertex paint and paint in the edges manually.
It would give you flexibility. Though it won’t be the most performant as translucent materials are move expensive.

Do you mean manually painting on the mesh itself?

Yes

alternatively you could use a dither node and a masked material

It should be cheaper to render.

The material i’m using is a masked one atm. I am unfortunately unable to manually paint vertex colors as the material will be used on many different meshes

The material gets it’s information from the mesh and uses it as an input so it can be shared among objects and retain it’s individual settings.

See, same material different vertex data.

You can change the uniformity of the effect with the random part of the dither node.

But wouldn’t I have to manually paint each different mesh? E.g. say I have a tree, a floor and a blender monkey that are using the material. Or what mesh would I paint in this case?

You could export the vertex color from blender and you could apply it there with a script if needed or by painting it.

If you want fully dynamic then you need something to drive that logic.

Hmm okay, I could try this. I know a lot of toon shaders are using edge detection, is this how they do it? Or should I maybe look into that too?

People use edge detection on a pixel shader level not on the material node itself. In unreal it’s usually a custom shader node.

Okay thanks for your help so far! I will try out some things and come back to you!

Another strategy is known as the hull/shell method. Basically you have a copy of the mesh, slightly scaled up. The scaled up mesh will be masked, while the regular one isn’t. Anywhere they overlap will look fully opaque, and the edges where only the scaled up mesh exist will be your fuzzy edges.

This sounds very interesting. I had a friend talk a bit about this before but would this require overlay materials? I need everything to be done in a single material

Its a methid used in dark souls (grey wolf sif) and in the shadow of colossus. It’s only drawback is that it uses many overlaping translucent materials that can hit performance with many shells. Rigging can also be complex.

The shells also add to the poly count.

Okay, doesn’t sound like the best solution then. Is there another better way of doing the material overall maybe? Besides just blending the edges?

You can probably get away with using just one layer of a masked material for the look you’re trying to achieve.
You can use overlay materials, otherwise you need to build the shell into the mesh.