I am attempting to create some Procedural Weathering Effects on a high-poly model using a similar Pointiness method to that discussed in my previous question and answer here. Whilst Cycles provides great results using this method, for the sake of speed I'm trying to replicate the effect in EEVEE.
As of Blender 2.81a, however, the
Pointiness node is not currently supported in EEVEE and, as discussed in this thread on the bug tracker, due to the intensive pre-processing step needed to compute the effect it is unlikely to be supported anytime soon.
This has led me down the path of attempting to manually replicate the colours that the Pointiness node generates by first using the
Dirty Vertex Colours operator (which is, in-practice, 1-click) to give me a vertex colour map of the mesh edges/cavities, and then essentially colour-correcting them (in a very rough fashion) to be visually similar to the output of the Pointiness attribute in cycles.
This has been somewhat successful when using the high-poly (~430k faces) 'Standford Buddha', and the following node setups for EEVEE/Cycles:
Whilst this works well for the buddha model, attempting to use the same correction parameters on different, lower-poly models yields drastically different results:
With a significant amount of tweaking, I'm sure the correction parameters could once again be adjusted to visually match the Pointiness output, however, I'm looking for a rapid, procedural approach that doesn't require a lot of manual changes.
Despite the issues, it does still seem like the 'Dirty Vertex Colours' approach could be the most promising. As a result, I'm debating whether a script or mathematical shader approach could be used to either replicate the basic Pointiness values and apply them as vertex colours or, alternatively, accurately remap the 'Dirty Vertex Colours' to the 'correct' Pointiness values. I'm assuming that a script that simply generates Pointiness colours based on the original algorithm from Sergey's patch may be simpler and more successful however, considering my initial problems.
Unfortunately, despite it not seeming like the algorithm is particularly complex, my knowledge of python and the code that goes into cycles shaders isn't sufficient enough to help me convert it. From Shadowphile's thread here on Blender Artists, it is suggested that Pointiness is generated by searching in a ring around a vertex/edge (one-ring neighbourhood), applying a value of
0.5 to flat surfaces, a value of >0.5 to outside edges and a value of <0.5 to inside edges, before adding an overall blur to approximate a two-ring neighbourhood.
In researching this problem more, I also came across Ambi's script here for better calculating Mesh Curvature to Vertex Colours (and the associated BA Thread). While this provides some insight into how iterating through the mesh and assigning colours could be achieved, it unfortunately uses different algorithms, and isn't directly related to my Pointiness problem; or ultimately converted for Blender 2.8x.
Thanks for taking the time to read, any help in shedding some light on this problem would be very much appreciated!
- Sergey's original patch and notes from when Pointiness was first implemented in Cycles.
- Shadowphile's dissection of how the Pointiness effect is generated.
- Ambi's BA Thread about his Mesh Curvature to Vertex Colours Script.
- Additional BA cross-post discussion thread.
- 'Understanding the Pointiness Algorithm' Devtalk thread.