How to deciamte a mesh preserving the shape?

I want to reduce the vertices as low as possible but I do not want to distorte the shape.
How can I do it?

Go in Edit mode, select some faces of which you think that could be one face. Press X and choose dissolve faces or limited dissolve.

Or Select Edge that doesn’t contribute to the shape, press x and choose dissolve edges.

Or use an addon called Optiloops. It calculated what edgeloops are contributing not that much to the shape and will remove those. Result is pretty much the same shape.

Maybe there are more ways, but this is from the top of my head.

( Oh yes or;
Copy mesh
Apply decimate modifier on the copy
*Add shrinkwrap modifier and wrap it around the original. *
Didn’t try it, so might be a bad idea. )

I want to do it programmatically.
I have tried few things as suggested
Since most of the elements does not have edge loops so Optiloops will not help.
Shrinkwrap result is also not good.

1 Like

What about this piece of code?

import bpy
obj = bpy.context.object

modifier = obj.modifiers.new("decimate", "DECIMATE")
modifier.iterations = 2
modifier.decimate_type = 'UNSUBDIV'

bpy.context.view_layer.objects.active  = obj
bpy.ops.object.modifier_apply(apply_as='DATA', modifier=modifier.name)

But still, I don’t think there is any silver bullet solution for this task. If there was, nobody needs to do retopology.

I have tried both collapse and unsubdivide.
In most cases unsubdivide does nothing.
Decimate does reduce but sometimes it is too much. That is why I am looking for mesh simplification with less errors.

Decimate Modifier, Choose planar as method, lower the angle limit till it is preserving all the details that you want to preserve). Add a triangulate modifier after it if lots of ngons scare you.

1 Like