Mesh offset code running on GPU. Have some distortion to track down.

That is super awesome.

Amazing!

@Miguel_Sanchez its output is like dropcutter, but it works in reverse. Instead of solving “how far down can a ball mill go at x,y?”, it solves “which set of x,y points does this triangle impact assuming a ball mill, and what are the Z values there?”. The GPU’s Z buffer cleans up overlap.

So is that why you have that wobble on the right ear?

Each triangle defines 3 spherical regions, 3 cylindical regions, and 1 flat region. It has a numeric stability bug; this causes it to drop part of the flat region, letting the curved regions dominate where they should have been covered up. I have an idea to fix it.

Solved the flat part. I also messed up projecting x,y onto cylinders which aren’t parallel to the xy plane and am working on a fix.

@Todd_Fleming go easy on me I’m a mechanical guy…

Are you taking the triangular mesh at a point in the XY and Z and interpolating them into spherical based on projection to gain an approximation of X,Y related to Z?

@Brandon_Satterfield It does the following for every triangle in the mesh (all on the GPU):

let r = offset distance and p1, p2, p3 = vertexes of original triangle.

There are spheres with radius r centered at p1, p2, and p3.

There are cylinders connecting p1 to p2, p1 to p3, and p2 to p3. The circles at the cylinders’ ends have radius r and are centered on p1, p2, or p3.

There is a new triangle offset r from the original.

The fragment shader draws the new shapes. It does this by projecting x, y onto the shapes and calculating z.

The result is a height map (right now I’m using 1024 * 1024). The blue lines scan the height map.

@Todd_Fleming You can project triangles using the normal vector of each one. How long does it take in your sample case? How many triangles has the object?

@Miguel_Sanchez The normal vector handles offsetting the old triangle to the new triangle. It does not calculate z from the xy projection; the GPU’s barycentric implementation does that, but it’s only useful for the triangle, not the cylinder.