This may be more of an excursion than an answer, because you did say 'modelling'.. This is shading.
Using OSL, it's possible to get a shader to respond to the topology of the underlying mesh. In particular, this script-node tells you:
In A
, B
, and C
, the World-Space locations of the corners of the render-triangle in which the shading-point happens to find itself.
In inCenter
, the World-Space location of that triangle's incenter
In inRadius
, the radius of the circle that would touch all the sides of the triangle at once, if centered on inCenter
.
shader TriangleInfo (
output vector A = 0.0,
output vector B = 0.0,
output vector C = 0.0,
output vector inCenter = 0.0,
output float inRadius = 0.0
)
{
A = P - (u*dPdu) - (v*dPdv);
B = A + dPdu;
C = A + dPdv;
float a = length(C-B);
float b = length(C-A);
float c = length(B-A);
float s = (a+b+c)/2.0;
inCenter = ((a*A)+(b*B)+(c*C))/(a+b+c);
inRadius = sqrt(s*(s-a)*(s-b)*(s-c))/s;
}
If Blender's Geometry node exposed dPdu
and dPdv
, which are actual World-Space vectors corresponding to u and v, if the triangle is expressed in barycentric coordinates, (i.e the vectors A->B and A->C, with my vertex labels) we wouldn't need to use OSL, But unfortunately, it doesn't.
Using this script-node, subtracting the locations it gives you from the shading point, and taking the length of the difference, you can get the distance of the shading-point from them. If you put those distances through Less Than thresholds, for example, you can generate a mask based on the triangles:
The circles around the vertices are thresholded distances from A
,B
,and C
(the same for each, in every triangle) and the ones in the middle are around the inCenter
s. Those ones can automatically vary in diameter to fit skew triangles, by being set to a percentage on the inRadius
, (which may be necessary, you can't tessellate a sphere with hexagons alone.)
By taking the minimum distance of the shading-point P
to any of A
,B
,C
, or the inCenter
, you can decide which 'feature' P
belongs to, and generate a distance-field:
This tree may look scary, but it's just doing the same thing over-again for the 4 points of interest:
Just distances would give you conical dimples, but you can change their profile very flexibly, to almost any style of golf-ball, by putting the distances through a Vector Curve node, as here, or a Color Ramp node.
The trouble is, we have to use OSL (CPU only), and Cycles. But once we're happy with the shape, we can plug the result of the tree straight into an Emission node, and bake the emission into a height-map:
.. which we can use for Bump mapping in any renderer, or Displacement mapping in Cycles:
Stupidly, I didn't use your ball as a reference. I'll try and fiddle with the curves to get one more like yours.