Xrvitd / CWF

Code of CWF: Consolidating Weak Features in High-quality Mesh Simplification, ACM Transactions on Graphics, SIGGRAPH 2024
https://ruixu.me/html/CWF/index.html
GNU Affero General Public License v3.0
210 stars 14 forks source link

Non-manifold results & Runtime error of "Division by 0" #12

Open JYChen18 opened 3 weeks ago

JYChen18 commented 3 weeks ago

When I try to simplify my mesh test.zip, I get the runtime error of "Division by 0" around the 47th iteration. The complete output is

====================CWF3DTest
Now file: test
600   test   
Pts.size(): 580

Begin CWF.

580  580
energy: 1190.405 LossCVT: 1174.63 LossQE: 74.5065 Lambda_CVT: 0.95
0       0       5.509016        52.3696 1190.405
energy: 1079.945 LossCVT: 1118.466 LossQE: 70.52912 Lambda_CVT: 0.9025
1       1       11.33909        43.65224        1079.945
energy: 888.4111 LossCVT: 986.5742 LossQE: 42.54709 Lambda_CVT: 0.857375
2       2       17.07771        17.56674        888.4111
energy: 813.1646 LossCVT: 955.8283 LossQE: 34.63646 Lambda_CVT: 0.8145062
3       3       22.73199        11.40167        813.1646
energy: 757.451 LossCVT: 937.5864 LossQE: 31.96448 Lambda_CVT: 0.7737809
4       4       28.419  8.641338        757.451
energy: 702.4945 LossCVT: 916.3748 LossQE: 28.87484 Lambda_CVT: 0.7350919
5       5       34.06476        7.01332 702.4945
energy: 660.7561 LossCVT: 909.8513 LossQE: 25.37307 Lambda_CVT: 0.6983373
6       6       39.66882        6.146051        660.7561
energy: 627.3019 LossCVT: 909.0363 LossQE: 24.22866 Lambda_CVT: 0.6634204
7       7       45.39689        4.464063        627.3019
energy: 593.3056 LossCVT: 906.9675 LossQE: 21.68984 Lambda_CVT: 0.6302494
8       8       51.11761        3.730231        593.3056
energy: 562.1694 LossCVT: 904.9953 LossQE: 20.31525 Lambda_CVT: 0.5987369
9       9       56.82121        3.001296        562.1694
energy: 535.7666 LossCVT: 907.9159 LossQE: 19.34394 Lambda_CVT: 0.5688001
10      10      62.48824        2.560384        535.7666
energy: 478.7922 LossCVT: 848.6359 LossQE: 20.22325 Lambda_CVT: 0.5403601
11      11      68.23156        2.353725        478.7922
energy: 457.594 LossCVT: 856.2621 LossQE: 18.03863 Lambda_CVT: 0.5133421
12      12      73.98542        1.822455        457.594
energy: 447.516 LossCVT: 888.4269 LossQE: 14.25242 Lambda_CVT: 0.487675
13      13      79.70566        1.744214        447.516
energy: 415.8467 LossCVT: 866.2084 LossQE: 14.53992 Lambda_CVT: 0.4632912
14      14      85.39101        1.749166        415.8467
energy: 343.0527 LossCVT: 752.5982 LossQE: 11.81414 Lambda_CVT: 0.4401267
15      15      90.93191        1.685091        343.0527
energy: 323.1877 LossCVT: 749.8103 LossQE: 9.676719 Lambda_CVT: 0.4181203
16      16      96.44375        1.637143        323.1877
energy: 366.8615 LossCVT: 895.4689 LossQE: 11.16843 Lambda_CVT: 0.3972143
energy: 350.6081 LossCVT: 896.431 LossQE: 12.33666 Lambda_CVT: 0.3773536
energy: 336.7289 LossCVT: 906.7932 LossQE: 11.65636 Lambda_CVT: 0.3584859
energy: 320.1571 LossCVT: 903.8751 LossQE: 12.33193 Lambda_CVT: 0.3405616
17      20      119.4074        1.669704        320.1571
energy: 308.1106 LossCVT: 919.7429 LossQE: 10.54288 Lambda_CVT: 0.3235335
energy: 288.8449 LossCVT: 906.559 LossQE: 10.20781 Lambda_CVT: 0.3073569
18      22      130.8072        2.020563        288.8449
energy: 275.373 LossCVT: 914.7255 LossQE: 8.283157 Lambda_CVT: 0.291989
19      23      136.4791        2.316179        275.373
energy: 262.5024 LossCVT: 916.0556 LossQE: 8.398156 Lambda_CVT: 0.2773896
20      24      142.1767        1.49152 262.5024
energy: 249.8548 LossCVT: 916.8098 LossQE: 8.256964 Lambda_CVT: 0.2635201
21      25      147.9086        1.316668        249.8548
energy: 237.7791 LossCVT: 918.8821 LossQE: 7.742345 Lambda_CVT: 0.2503441
22      26      153.6618        1.108372        237.7791
energy: 224.8228 LossCVT: 915.7385 LossQE: 7.035599 Lambda_CVT: 0.2378269
23      27      159.399 1.179789        224.8228
energy: 214.2248 LossCVT: 924.9581 LossQE: 5.243863 Lambda_CVT: 0.2259355
24      28      165.1142        1.452649        214.2248
energy: 202.9737 LossCVT: 919.7529 LossQE: 5.559105 Lambda_CVT: 0.2146388
25      29      170.8424        1.884581        202.9737
energy: 191.1635 LossCVT: 911.1425 LossQE: 5.375279 Lambda_CVT: 0.2039068
26      30      176.4879        1.130287        191.1635
energy: 181.8003 LossCVT: 913.5885 LossQE: 4.827723 Lambda_CVT: 0.1937115
27      31      182.1159        0.8779488       181.8003
energy: 173.0069 LossCVT: 914.1135 LossQE: 4.786326 Lambda_CVT: 0.1840259
28      32      187.7958        0.7588822       173.0069
energy: 164.5583 LossCVT: 913.1746 LossQE: 4.912885 Lambda_CVT: 0.1748246
29      33      193.4362        1.162131        164.5583
energy: 157.3782 LossCVT: 918.1807 LossQE: 4.883641 Lambda_CVT: 0.1660834
30      34      199.1338        1.603718        157.3782
energy: 154.677 LossCVT: 929.6119 LossQE: 8.003512 Lambda_CVT: 0.1577792
energy: 142.7574 LossCVT: 916.3574 LossQE: 5.404354 Lambda_CVT: 0.1498903
energy: 136.4701 LossCVT: 925.2756 LossQE: 4.71478 Lambda_CVT: 0.1423957
31      37      216.1982        1.87862 136.4701
energy: 128.7815 LossCVT: 920.6803 LossQE: 4.235602 Lambda_CVT: 0.135276
32      38      221.8987        1.31555 128.7815
energy: 121.8032 LossCVT: 917.4852 LossQE: 3.895165 Lambda_CVT: 0.1285122
33      39      227.5919        1.19882 121.8032
energy: 115.7726 LossCVT: 916.3122 LossQE: 3.903213 Lambda_CVT: 0.1220865
34      40      233.3319        1.180581        115.7726
energy: 110.4957 LossCVT: 922.8002 LossQE: 3.467298 Lambda_CVT: 0.1159822
35      41      239.0501        0.9104245       110.4957
energy: 105.0576 LossCVT: 925.228 LossQE: 3.113097 Lambda_CVT: 0.1101831
36      42      244.694 0.9187937       105.0576
energy: 100.1742 LossCVT: 927.4507 LossQE: 3.094227 Lambda_CVT: 0.104674
37      43      250.3699        0.8670908       100.1742
energy: 94.69851 LossCVT: 920.3731 LossQE: 3.176367 Lambda_CVT: 0.09944026
38      44      256.0839        0.681827        94.69851
energy: 90.67757 LossCVT: 923.7584 LossQE: 3.411741 Lambda_CVT: 0.09446824
39      45      261.9016        0.9094846       90.67757
energy: 85.94997 LossCVT: 919.2461 LossQE: 3.452384 Lambda_CVT: 0.08974483
40      46      267.7374        0.9872688       85.94997
terminate called after throwing an instance of 'std::runtime_error'
  what():  Division by 0!
[1]    1887760 abort (core dumped)  ./MAIN

Another problem is that the resulting mesh is not strictly a 2-manifold, which is necessary for my downstream task, i.e. SDF query. image

Xrvitd commented 3 weeks ago

Hi When the model has sharp corners or thin plates and the sampling is sparse, the dual of RVD may appear non-manifold or erroneous. This is one of the defects of RVD itself. We cannot guarantee the manifold mesh output, which is also one of the limitations of CWF. As for the division by zero error you encountered, I don't think I have seen it before. Maybe you can try a different model or sampling.

Best, Rui

JYChen18 commented 3 weeks ago

Thank you for your quick reply!

After sampling 1000 or 2000 initial points, the runtime error is resolved, but the non-manifold issue still persists.

Finally, I found another repository, ACVD, which is capable of generating a manifold output. While it doesn't perform as well at preserving weaker features compared to your approach, it runs significantly faster and suits my current needs.

Since I’m not familiar with this area of research, I'm unsure if their method for enforcing manifold outputs could be applied here. For now, I plan to use their method to save effort. However, I’d be happy to revisit your excellent work if there is any update addressing the non-manifold issue.

Thanks again for your work and help!

Xrvitd commented 3 weeks ago

Thanks for your suggestion! We will consider that!