8
$\begingroup$

The contrast for the pointiness changes depending on the vertex density on the model. The Normalize node to have a value range of 0 to 1 isn't available in the shader editor. I thought it would be maybe possible to get this result with some Math nodes.

On the image bellow I am trying to get the same contrast between those two Suzannes, they have a different material each:

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Note that you can use the new Bevel node for a similar effect that won't change with subsurf. This is because the bevel is calculated differently. $\endgroup$ – Drudge Oct 10 '18 at 3:03
10
$\begingroup$

In order to map the pointiness values in the current view to a 0-1 range, a renderer would have to accumulate information about the entire frame or object, and then backtrack to adjust values between the maximum and minimum found. I'm confident Cycles can't do that.

There might be a more accurate method via baking and a histogram, but the approach I took to doing it by eye was to put the values through a color ramp, with the top 2% yielding blue, and the bottom 2%, red.

I then adjusted the 'Add' node to get a bare minimum of red, and the Multiply node to just hit the blue end. These were the figures for Suzanne, (top row), and Suzanne subddiv 2.

enter image description here

The top pair below were for calibration, the bottom pair the result with the color ramp taken out.

enter image description here

Maybe the regions would match more closely if we glue her eyes in.

$\endgroup$
6
+25
$\begingroup$

The Pointiness surface property is not very suited to this as, as you found, the result is very dependent on the vertex density of the mesh. Simply adding a Subsurf modifier will produce drastically different results.

As mentioned in @RobinBetts answer, it's not possible to automatically 'normalize' such a shader function as Blender would need to evaluate every point to be able to determine the true 'range' in order to determine how to normalize that range to fit 0.0 to 1.0.

A better solution would be to produce consistent results irrespective of the actual vertex density. Such a function isn't available in the current 'official' (2.79b) release of Blender but the development builds do now provide an Ambient Occlusion node that can be used to produce an alternative to Pointiness which is more configurable and that is not dependent on vertex density.

The new Ambient Occlusion node will sample the surrounding mesh to determine effectively how 'flat' that point on the surface is, which could be considered a measure of 'pointiness'. The node allows the strength of the effect to be controlled by adjusting the 'Distance' from which to calculate the occlusion and can also determine the 'reverse' occlusion (as it would be occluded from the 'inside' of the object) which can be used for 'negative pointiness' ("concavity"?).

By combining two Ambient Occlusion nodes - one set to 'Inside' and the other 'Outside' - we can produce an overall 'pointiness' that varies from 0.0 for 'full pointiness' to 1.0 for 'full concavity' as follows :

nodes and result

The above image shows the result on a cube flanked by two Suzannes, one with no subdivision and the other with two levels of subdivision, showing that the results are effectively the same regardless of vertex density and without requiring any manual adjustment - with the color ramp showing red for 'pointiness' through to green (flattness) and blue (concave).

The two Ambient Occlusion nodes will produce values in the range 0.0 to 1.0. These are combined by inverting the range (to 1.0 to 0.0) so that the 'flat' regions of both relate to 0.0), negating one, and adding together to produce a range from -1.0 to 1.0. This is then scaled and shifted to correspond to the range 0.0 to 1.0 by the Divide (by 2) and Add (0.5) nodes.

The strength of the 'inside' occlusion is dependent on the scale of the mesh and this can be adjusted via the Distance of the bottom Ambient Occlusion node. Also note that Blender determines the occlusion based on a number of samples of the surrounding geometry - lower number of samples will be quicker but produce more 'grainy' results; higher number of samples will produce smoother results but longer render times.

monochrome

$\endgroup$
  • 1
    $\begingroup$ Isn't the effect symmetrical? (i.e. the 'outside' values are just as dependent on scale as the 'inside' values?) ...it's just that outsides of familiar objects tend to be dominantly smooth-convex? $\endgroup$ – Robin Betts Oct 22 '18 at 13:20
  • 1
    $\begingroup$ @RobinBetts You're quite right - it should - but it appears to produce different results between 'Inside' and 'Outside' when the Distance is zero, so I'd increased distance for the Inside as otherwise it didn't detect inside edges. Having retried this, it seems to provide better results when both are set above zero - I presume zero actually relates to effectively infinite distance. A small value for both seems to work well, but this will mean that both are dependent on scale. $\endgroup$ – Rich Sedman Oct 22 '18 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.