Understanding the Pointiness Algorithm

The Pointiness attribute of the Geometry node is incredibly useful in rapidly creating procedural weathering effects in Cycles, but currently it’s not available for use in EEVEE. I’ve been working on a series of node-groups intended to rapidly create edge-wear and cavity-dirt effects (in which the Pointiness attribute is an integral component), and have been considering how to port this to EEVEE.

Obviously full feature parity for the Pointiness node in EEVEE would be the ultimate goal (@Hypersomniac’s authored task (T68479) suggests a week’s work to implement, though it is currently low-priority), however one solution I’ve been looking into in the meantime is putting together a Python script that essentially uses the same algorithm as the Cycles code to write the Pointiness values to a mesh’s vertex colours (in a similar way that the Dirty Vertex Colours operator works). Although a slower workflow than computing the shader at render-time, baking the vertex colours would still essentially be a one-click process, and does not require a UV Map. I’ve been trying to wrap my head around @sergey’s original patch (D1086), however my knowledge of C++ is lacking and so far I haven’t made much progress in my understanding.

I was mainly hoping that someone with more knowledge on the topic could lend some advice as to whether this solution would be feasible, and whether it would even be possible to adapt the algorithm from the Cycles code. I’m relatively new to Python development as it is, but feel it could be a good project to get my teeth into! :grin:

Apologies as well if this is the wrong part of the forum to post this thread, I considered the Python API section however I think first and foremost it’s important to understand the underlying algorithm before thinking about how to port it to an addon. Thanks! :slightly_smiling_face:

Some additional links from my research on the topic:

  1. BSE post detailing my use-cases further.
  2. BA thread loosely discussing how the Pointiness value is generated.

I wrote an addon to bake AO to vertex colors; while it’s not the same algorithm as pointiness (and is quite a bit slower, too), it might be useful to study.

1 Like

Thanks @zlsa, I’ve looked at the dirty vertex colours python file in the source, but it’ll defnitely be useful to see other approaches and similar implementations when I get to that stage.