Cycles: implement pointiness geometry attribute
ClosedPublic

Authored by Sergey Sharybin (sergey) on Feb 9 2015, 12:09 PM.

Details

Summary

This attribute means how "pointy" the geometry surface is, which allows to do
effects like dirt maps and wear-off effects on render geometry. This means the
attribute is calculated for the final mesh which means no baking (which implies
UV unwrap) is needed. Apart from this the behavior is quite close to how vertex
dirty colors works.

The new attribute is available as an output socket of Geometry node.

There's no penalty for the render time, only some delay on scene preparation
(the delay is linear of the mesh complexity).

Diff Detail

Repository
rB Blender
Kévin Dietrich (kevindietrich) added inline comments.
intern/cycles/blender/blender_mesh.cpp
405

Typo: should be vertex_indices. ;)

426

Over-indented.

intern/cycles/blender/blender_mesh.cpp
405

Done.

426

I'm not sure what you mean by this.

intern/cycles/blender/blender_mesh.cpp
426

My bad :). I read too quickly and didn't catch it was in the 'if()' block, so it seemed over-indented.

So this looks like a kind of mesh curvature, which may be a better name? Though perhaps it's ok to have a different name since this is more of an approximation.

The weak point of this is that it depends highly on the number of subdivision levels, as you subdivide more the pointiness will go to zero. The algorithms to compute a proper curvature are quite a lot more complicated and slower though, so perhaps this ok and a limitation users need to deal with?

@Brecht Van Lommel (brecht), mesh curvature is more a parametric property, here it is just a rough approximation. It is for sure possible to use some more accurate approximation, but that could also mean we can't use vertex attribute anymore (strictly speaking curvature of points on the face is not an interpolation of curvature on the adjacent vertices). Going more advanced is also gets complicated because the mesh storage is not best for such applications.

The guys from Gooseberry team are actually testing the patch, and think if they're happy we can use current approximation as a starting point without going crazy about complicating the calculation.

Sorry for the spam, but seems there's a shortcut to submit the form =/

The thing which is really missing is tooltips for sockets. They would help making more clear what attributes mean. That would be nice to address but as a separate patch i'd say.

Reworked a bit the patch:

  • Use edges direction for pointiness calculation Normals approach didn't work totally well for non-flat quads.
  • Added one step of blurring. so we're getting closer to 2 ring neighbourhood estimation.

neighborhood vs neighbourhood, hrm

On the second thought it's better to avoid negative values.

Much easier to map stuff with color ramp in this way it seems.

Could this be also used as a bevel shader?

So this looks like a kind of mesh curvature, which may be a better name? Though perhaps it's ok to have a different name since this is more of an approximation.

This approximation gives the same value on a saddle point as it does on flat geometry while a saddle point could be considered curved. I also cannot seem to think of a better name.

It would be cool to see what artists actually use this for.

@Sergey Sharybin (sergey) as far as code quality I am happy

There's no penalty for the render time, only some delay on scene preparation
(the delay is linear of the mesh complexity).

This statement only holds when the feature is actually being used, and in this case the 'cost' / benefit analysis is up the the artist in my opinion

This revision is now accepted and ready to land.Feb 10 2015, 11:48 AM
This revision was automatically updated to reflect the committed changes.

So this looks like a kind of mesh curvature, which may be a better name? Though perhaps it's ok to have a different name since this is more of an approximation.

So maybe Curvature Approx.?