Would you like lumps with that?

Saturday, April 7th, 2007 at 10:55 pm

It’s taken about a day and a half of experimental programming. Them at the university have been producing porous metal objects using Selective Laser Melting, but the surface is coming out too smooth. That is, they’re making objects with a very fine 3D texture, like compressed steel wool, but the surface feels as though it’s been cut perfectly with a fine saw, so it lacks all those poky out wires necessary to snag the fabric of your tie.

So the idea is to pockmark the model a bit to give it some roughness.

This algorithm works by selecting a whole bunch of pock-mark points that are randomly distributed around the surface (do this by picking triangles at random, weighted by their area, and picking random points in them until you have enough, and offsetting a random distance along the normal).

For each pock-mark point m, define the function fm(p) for any point p in the model (or anywhere in space).

Let v = p - m and d = |v|. For d > 1, let fm(p) = p. Otherwise, let the result be m + s v, where:

s = d^3 – 2d^2 + 2d

This is a cubic spline which satisfies s(0) = 0, s(1) = 1, and s'(1) = 1, so that it merges smoothly to the identity (y = x) line.

This pock-mark function is simply for bunching up space within the fixed distance 1.0 of the point p; kind of like poking your finger into a smooth slab of clay, except in 3D.

Starting with any point in the triangulated model which you want to make lumpy, apply all your pock-mark functions in order at that point, and that’s your new position.

fm1(fm2(...fmn(p)...))

Originally I made the pock-mark functions work additively; the pock-mark functions returned a displacement vector, and then these were summed. This method is favoured because it’s symmetric — it doesn’t matter what order you apply the pock-mark points — but it results in folding if two pock-mark points are close together such that the attractor gets too heavily weighted. Composition of functions just moves the points closer to the attractor, and doesn’t make it go past.

Subject to the small issue of rustling up a means of subdividing triangles that is not completely rubbish, the problem is done. Now it’s possible to easily generate models with thousands of times more triangles so that any downstream operation based on it will almost certainly fail. I think I can tell what the next job is going to be.