I'm going to be getting a 3D scanner


RE: I'm going to be getting a 3D scanner
#26
(Yesterday, 17:19)PeterĀ Grass Wrote: There are apps to selectively decrease the amount of polygons while keeping the detail but they are crazy expensive since they are meant for game development so certainly not in my budget. You could maybe manually do it in blender but that would take ages and not be a fun task.

We certainly can write some script that does a decent job at mesh reduction. The trick is to remove the vertices where the normals of the surrounding triangles are as parallel as possible. This is a lot more calculation-intensive that just averaging the vertexes of selected non-touching triangles.

For the algorithm:
  1. For every triangle, calculate the surface normal.
  2. For each vertex, calculate the sum of all angles between adjacent normal pairs around that vertex. The number of triangles doesn't matter, as doesn't the curvature "through" the vertex. The sum will catch all that and more.
  3. For each triangle, calculate the sum of the sum_of_angles of its three vertices.
  4. Sort the triangles and their sum_of_sum_of_angles.
  5. Determine a suitable cutoff or a suitable number of triangles to remove.
  6. Begin looping thru each triangle, starting from the smallest sum_of_sum_of_angles. Check that none of its three vertexes are embargoed. Remove the triangle by averaging its three vertices. Adjacent triangles where two of its vertexes merge are removed at the same time. Place all surrounding vertexes in an embargo, i.e. they cannot be removed during this round.
  7. At some point, looping thru triangles will no longer yield anything reasonable to remove. However, the cutoff should have been encountered long before such happens.
  8. Go back to step 1 and repeat. Updated normals need to be calculated only for triangles that have been modified by the merging of vertices. All embargoed vertices need updated sum_of_angles.

Some additional notes: In the general case, it is impossible to remove just one vertex from a mesh because one cannot guarantee that the surrounding vertices are in a convex shape. Furthermore, any new triangles might become very long and narrow, which is highly undesirable.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: I'm going to be getting a 3D scanner - by Peter Blomberg - 6 hours ago

Forum Jump:


Users browsing this thread: 4 Guest(s)