I should add that this method (doing a dot product) is almost the same as the divergence thingy. The standard way of calculating these things is just to offset in x,y and z axis to get the sample offsets. The difference in what I’ve done is that I am using the gradient as the sample offset.
Here is an example of the ‘curvature’ laplacian operation to get the general nooks and crannies…
small sample offset width = smaller details
larger sample offset width = bigger features.
Remember to clamp those before using them as well because there are negative values which are the ‘open’ areas. You could reverse those values to get an ‘exposed’ mask.