the Pointiness value, dissected

Pointiness is a great tool because it will give you more surface information about your object than anything you can calculate with nodes. The obvious use is to color the curvy parts of a surface (but not very exactly).
So.
Pointiness…what does that input actually mean? Why is it not called Curvature?

Pointiness is a low-res way of describing the curvature of the mesh surface. If the surface is flat, it is 0.5. Outside edges are larger than .5 and inside edges less than .5.
In practice, even for extreme razor-blade-like edges I see Pointiness values stay between about .4 to .6 though.

But what does ‘curvature’ mean?
It means ‘How much does my normal direction change when I move sideways by a SPECIFIC step amount?’
Blender uses the size of one polygon as a step size. If there are only two polygons, then one step would be moving from the first polygon to the second. For only two polygons, the change in Normal direction is just the angle between the faces.
Blender looks at an edge between two faces and measures the angle between them.
So curvature (therefore Pointiness) is only accurate at the edges of faces. The rest of the faces are covered by interpolations (it also applies where more than two faces touch each other).

But what happens if I take a single edge and subdivide it?

This picture shows how the ‘curved’ region shrinks with resolution (for hard edges).
Subdivide it down two levels and now the coloring that shows the amount of curvature has shrunk to a tiny region along the edges, EVEN THOUGH THE TWO MESHES HAVE THE EXACT SAME SHAPE.


This picture shows that a Subdivision Surfaced mesh washes out the Pointiness values when the mesh resolution is increased (same Material is used on both in this image)
Basically when a mesh is subdivided, the large angles are converted into a several smaller angles connected together.
But since Pointiness describes angles, not curvature, this sphere with the same (theoretical) curvature does not color the same with a different resolution.


If you want to make an edge or crack shader, you need an Intensity slider to compensate (some).
A simple method is take the Pointiness value, subtract 0.5 from it, multiply by your Intensity value, then add 0.5 back. Change the Intensity value until the Pointiness shading becomes visible in your material render. That helps.

Towards a truer Curvature value
There is a problem however: What if I have a large flat surface made of lots of little jaggy edges? I may only want to show the average flatness. No can do. No matter how much I increase the intensity, I cannot smooth out sharp edges or points.

There are probably attempts to compensate for this in the code but I can’t see it much.
Ideally there would be a control labeled ‘Averaging Size’. Technically it should range in dimensions like meters or inches. To make life easy for the coders though we might just have a control labeled ‘Polygons’ that controls how big a region of polygons are averaged to make the Pointiness value in the middle of that region. That would work fine for evenly spaced meshes.
The Distance parameter in ambient occlusion actually uses a similar concept.

I hope this has been useful to somebody. Feel free to comment or correct any bad conclusions I may have made.

Attachments


2 Likes

The pointiness value as of present only takes into account the angle of verts to surrounding edges (with a slight blur) and does not take distance to such verts into account in any way, shape, or form. It does have the disadvantage as seen in the image, but it does make it very fast to calculate (even with millions of verts) and unlike a dirt shader, does not produce any additional time during a render.

Supposedly, it should be possible for a developer to base pointiness on the distance to angled vertices instead, but that may mean a notably longer calculation time in the render prep. stage.

Ah, thanks Ace Dragon. I suppose basing on vertices makes more since than the math would be the same for any number of shared polys.
The slight blur also explains why I could jack the gain on the pointiness (ie multiply by) to extremely high numbers like 100 million and get the pointiness coloring to bleed beyond the far edge of the polygon.

here is getting pointiness in realtime using geometry nodes :smiley:

2 Likes

Why was this thread bumped, especially when noting that Cycles has true AO color shading now?

It is good that we now have a lot more ways to create masks for Cycles shading (via Geometry Nodes), but I do not think it justified bumping a 6-year-old thread in the materials section.

1 Like

this works in realtime in eevee :smiley:

this is to correct that they never made pointiness work in realtime

1 Like