MeshLabServer - Simplification : Quadric Edge Collapse Decimation (WITH TEXTURE) Failure

3.1k views Asked by At

I test some decimation / simplification tools to reduce triangles number of many OBJ files who represent a 3D model programmatically.

I have a problem with the function "Simplification: Quadric Edge Collapse Decimation (with texture) in MeshLab.

When I run the function I get the message : Filter failure message

I found a workaround with the IDE, I apply the function Filters / Texture / Converts PerVertex UV into PerWedge UV and then apply the simplification filter... But in the MeshLabXML api i can't find the filter to convert UV texture coordinates...

Anyone have had the problem? And resolved it?

2

There are 2 answers

1
Rockcat On BEST ANSWER

You have two alternatives to do that:

First takes two steps:

  1. Convert your mesh to per-wedge-textured using the command meshlabserver -i inputMesh.obj -o tmpMesh.obj -m wt
  2. Apply your other filters using meshlabserver -i tmpMesh.obj -o outputMesh.obj -m wt -s myScript.mlx

The second alternative is do everything in just a step, by calling the filter Convert PerVertex UV into PerWedge UV in your mlx script before of calling Simplification: Quadric Edge .... Also, I suggest to call Remove Unreferenced Verticesjust by sanity.

Try saving this script to a file named textureSimplify.mlx

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Remove Unreferenced Vertices"/>
 <filter name="Convert PerVertex UV into PerWedge UV"/>
 <filter name="Simplification: Quadric Edge Collapse Decimation (with texture)">
  <Param value="3000" name="TargetFaceNum" description="Target number of faces" isxmlparam="0" tooltip="" type="RichInt"/>
  <Param value="0" name="TargetPerc" description="Percentage reduction (0..1)" isxmlparam="0" tooltip="" type="RichFloat"/>
  <Param value="0.3" name="QualityThr" description="Quality threshold" isxmlparam="0" tooltip="" type="RichFloat"/>
  <Param value="1" name="Extratcoordw" description="Texture Weight" isxmlparam="0" tooltip="" type="RichFloat"/>
  <Param value="false" name="PreserveBoundary" description="Preserve Boundary of the mesh" isxmlparam="0" tooltip="" type="RichBool"/>
  <Param value="1" name="BoundaryWeight" description="Boundary Preserving Weight" isxmlparam="0" tooltip="" type="RichFloat"/>
  <Param value="true" name="OptimalPlacement" description="Optimal position of simplified vertices" isxmlparam="0" tooltip="" type="RichBool"/>
  <Param value="true" name="PreserveNormal" description="Preserve Normal" isxmlparam="0" tooltip="" type="RichBool"/>
  <Param value="true" name="PlanarQuadric" description="Planar Simplification" isxmlparam="0" tooltip="" type="RichBool"/>
  <Param value="false" name="Selected" description="Simplify only selected faces" isxmlparam="0" tooltip="" type="RichBool"/>
 </filter>

</FilterScript>

Edit the line <Param value="3000" name="TargetFaceNum" to change the value 3000 to your desired number of faces, and then execute the script using the command:

> meshlabserver -i inputMesh.obj -o outputMesh.obj -m wt -s textureSimplify.mlx
0
sebastian On

Since Meshlab 2020.12, meshlabserver has been replaced by PyMeshLab.

Quadric Edge Collapse is documented here.