LSCM implementation by OpenNL shows overlapping triangles in its UV mapping

253 views Asked by At

I am using the Least square conformal map algorithm implemented by opennl without any change. With the spectral mode of the algorithm I get overlapping triangles in the UV mapping. For a cone triangulated object, it shows the following output,

enter image description here

Where the output should be something like this,

enter image description here

I went through the code and paper. Frankly I didn't understand the math behind the implementation and for that I could not find why this is happening. The cone object is here

# This file uses centimeters as units for non-parametric coordinates.

mtllib cone_triangulated.mtl
g default
v 5.440012 -1.000000 -0.309017
v 5.297973 -1.000000 -0.587786
v 5.076741 -1.000000 -0.809017
v 4.797972 -1.000000 -0.951057
v 4.488955 -1.000000 -1.000000
v 4.179938 -1.000000 -0.951057
v 3.901170 -1.000000 -0.809017
v 3.679938 -1.000000 -0.587785
v 3.537898 -1.000000 -0.309017
v 3.488955 -1.000000 0.000000
v 3.537898 -1.000000 0.309017
v 3.679938 -1.000000 0.587785
v 3.901170 -1.000000 0.809017
v 4.179938 -1.000000 0.951057
v 4.488955 -1.000000 1.000000
v 4.797972 -1.000000 0.951057
v 5.076741 -1.000000 0.809017
v 5.297972 -1.000000 0.587785
v 5.440012 -1.000000 0.309017
v 5.488955 -1.000000 0.000000
v 4.488955 1.000000 0.000000
vt 0.710013 0.000454
vt 0.773162 0.000454
vt 0.640012 0.453512
vt 0.823278 0.000454
vt 0.640012 0.000454
vt 0.570010 0.000454
vt 0.506861 0.000454
vt 0.456745 0.000454
vt 0.413641 0.454510
vt 0.476790 0.454510
vt 0.546791 0.907569
vt 0.546791 0.454510
vt 0.363525 0.454510
vt 0.616793 0.454510
vt 0.679942 0.454510
vt 0.730058 0.454510
vt 0.442471 0.156982
vt 0.453558 0.226983
vt 0.442471 0.296985
vt 0.410295 0.360134
vt 0.360180 0.410249
vt 0.297030 0.442425
vt 0.227029 0.453512
vt 0.157028 0.442425
vt 0.093878 0.410249
vt 0.043763 0.360134
vt 0.011587 0.296985
vt 0.000500 0.226983
vt 0.011587 0.156982
vt 0.043763 0.093832
vt 0.093878 0.043717
vt 0.157027 0.011541
vt 0.227029 0.000454
vt 0.297030 0.011541
vt 0.360180 0.043717
vt 0.410295 0.093832
vt 0.999501 0.907569
vt 0.936351 0.907569
vt 0.866350 0.454510
vt 0.866350 0.907569
vt 0.796348 0.907569
vt 0.733199 0.907569
vt 0.094082 0.454510
vt 0.157231 0.454510
vt 0.227233 0.907569
vt 0.227233 0.454510
vt 0.297234 0.454510
vt 0.360383 0.454510
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.850651 0.447214 -0.276392
vn 0.723607 0.447214 -0.525731
vn 0.000000 1.000000 -0.000005
vn 0.525731 0.447214 -0.723607
vn 0.276393 0.447214 -0.850651
vn -0.000000 0.447214 -0.894427
vn -0.276393 0.447214 -0.850651
vn -0.525731 0.447214 -0.723607
vn -0.723607 0.447214 -0.525731
vn -0.850651 0.447214 -0.276393
vn -0.894427 0.447214 0.000000
vn -0.850651 0.447214 0.276393
vn -0.723607 0.447214 0.525731
vn -0.525731 0.447214 0.723607
vn -0.276393 0.447214 0.850651
vn 0.000000 0.447214 0.894427
vn 0.276393 0.447214 0.850651
vn 0.525731 0.447214 0.723607
vn 0.723607 0.447214 0.525731
vn 0.850651 0.447214 0.276393
vn 0.894427 0.447214 0.000001
s 1
g pasted__pCone1 group1
usemtl initialShadingGroup
f 1/17/1 20/18/2 2/36/3
f 20/18/2 19/19/4 2/36/3
f 19/19/4 18/20/5 2/36/3
f 18/20/5 17/21/6 2/36/3
f 17/21/6 16/22/7 2/36/3
f 16/22/7 15/23/8 2/36/3
f 15/23/8 14/24/9 2/36/3
f 14/24/9 13/25/10 2/36/3
f 13/25/10 12/26/11 2/36/3
f 12/26/11 11/27/12 2/36/3
f 11/27/12 10/28/13 2/36/3
f 10/28/13 9/29/14 2/36/3
f 9/29/14 8/30/15 2/36/3
f 8/30/15 7/31/16 2/36/3
f 7/31/16 6/32/17 2/36/3
f 6/32/17 5/33/18 2/36/3
f 5/33/18 4/34/19 2/36/3
f 4/34/19 3/35/20 2/36/3
s 2
f 1/1/21 2/2/22 21/3/23
f 2/2/22 3/4/24 21/3/23
f 3/37/24 4/38/25 21/39/23
f 4/38/25 5/40/26 21/39/23
f 5/40/26 6/41/27 21/39/23
f 6/41/27 7/42/28 21/39/23
f 7/13/28 8/9/29 21/11/23
f 8/9/29 9/10/30 21/11/23
f 9/10/30 10/12/31 21/11/23
f 10/12/31 11/14/32 21/11/23
f 11/14/32 12/15/33 21/11/23
f 12/15/33 13/16/34 21/11/23
f 13/43/34 14/44/35 21/45/23
f 14/44/35 15/46/36 21/45/23
f 15/46/36 16/47/37 21/45/23
f 16/47/37 17/48/38 21/45/23
f 17/8/38 18/7/39 21/3/23
f 18/7/39 19/6/40 21/3/23
f 19/6/40 20/5/41 21/3/23
f 20/5/41 1/1/21 21/3/23
g default
v 5.440012 -1.000000 -0.309017
v 5.297973 -1.000000 -0.587786
v 5.076741 -1.000000 -0.809017
v 4.797972 -1.000000 -0.951057
v 4.488955 -1.000000 -1.000000
v 4.179938 -1.000000 -0.951057
v 3.901170 -1.000000 -0.809017
v 3.679938 -1.000000 -0.587785
v 3.537898 -1.000000 -0.309017
v 3.488955 -1.000000 0.000000
v 3.537898 -1.000000 0.309017
v 3.679938 -1.000000 0.587785
v 3.901170 -1.000000 0.809017
v 4.179938 -1.000000 0.951057
v 4.488955 -1.000000 1.000000
v 4.797972 -1.000000 0.951057
v 5.076741 -1.000000 0.809017
v 5.297972 -1.000000 0.587785
v 5.440012 -1.000000 0.309017
v 5.488955 -1.000000 0.000000
v 4.488955 1.000000 0.000000
vt 0.710013 0.000454
vt 0.773162 0.000454
vt 0.640012 0.453512
vt 0.823278 0.000454
vt 0.640012 0.000454
vt 0.570010 0.000454
vt 0.506861 0.000454
vt 0.456745 0.000454
vt 0.413641 0.454510
vt 0.476790 0.454510
vt 0.546791 0.907569
vt 0.546791 0.454510
vt 0.363525 0.454510
vt 0.616793 0.454510
vt 0.679942 0.454510
vt 0.730058 0.454510
vt 0.442471 0.156982
vt 0.453558 0.226983
vt 0.442471 0.296985
vt 0.410295 0.360134
vt 0.360180 0.410249
vt 0.297030 0.442425
vt 0.227029 0.453512
vt 0.157028 0.442425
vt 0.093878 0.410249
vt 0.043763 0.360134
vt 0.011587 0.296985
vt 0.000500 0.226983
vt 0.011587 0.156982
vt 0.043763 0.093832
vt 0.093878 0.043717
vt 0.157027 0.011541
vt 0.227029 0.000454
vt 0.297030 0.011541
vt 0.360180 0.043717
vt 0.410295 0.093832
vt 0.999501 0.907569
vt 0.936351 0.907569
vt 0.866350 0.454510
vt 0.866350 0.907569
vt 0.796348 0.907569
vt 0.733199 0.907569
vt 0.094082 0.454510
vt 0.157231 0.454510
vt 0.227233 0.907569
vt 0.227233 0.454510
vt 0.297234 0.454510
vt 0.360383 0.454510
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.850651 0.447214 -0.276392
vn 0.723607 0.447214 -0.525731
vn 0.000000 1.000000 -0.000005
vn 0.525731 0.447214 -0.723607
vn 0.276393 0.447214 -0.850651
vn -0.000000 0.447214 -0.894427
vn -0.276393 0.447214 -0.850651
vn -0.525731 0.447214 -0.723607
vn -0.723607 0.447214 -0.525731
vn -0.850651 0.447214 -0.276393
vn -0.894427 0.447214 0.000000
vn -0.850651 0.447214 0.276393
vn -0.723607 0.447214 0.525731
vn -0.525731 0.447214 0.723607
vn -0.276393 0.447214 0.850651
vn 0.000000 0.447214 0.894427
vn 0.276393 0.447214 0.850651
vn 0.525731 0.447214 0.723607
vn 0.723607 0.447214 0.525731
vn 0.850651 0.447214 0.276393
vn 0.894427 0.447214 0.000001
s 1
g pasted__pCone1 group1
f 22/65/42 41/66/43 23/84/44
f 41/66/43 40/67/45 23/84/44
f 40/67/45 39/68/46 23/84/44
f 39/68/46 38/69/47 23/84/44
f 38/69/47 37/70/48 23/84/44
f 37/70/48 36/71/49 23/84/44
f 36/71/49 35/72/50 23/84/44
f 35/72/50 34/73/51 23/84/44
f 34/73/51 33/74/52 23/84/44
f 33/74/52 32/75/53 23/84/44
f 32/75/53 31/76/54 23/84/44
f 31/76/54 30/77/55 23/84/44
f 30/77/55 29/78/56 23/84/44
f 29/78/56 28/79/57 23/84/44
f 28/79/57 27/80/58 23/84/44
f 27/80/58 26/81/59 23/84/44
f 26/81/59 25/82/60 23/84/44
f 25/82/60 24/83/61 23/84/44
s 2
f 22/49/62 23/50/63 42/51/64
f 23/50/63 24/52/65 42/51/64
f 24/85/65 25/86/66 42/87/64
f 25/86/66 26/88/67 42/87/64
f 26/88/67 27/89/68 42/87/64
f 27/89/68 28/90/69 42/87/64
f 28/61/69 29/57/70 42/59/64
f 29/57/70 30/58/71 42/59/64
f 30/58/71 31/60/72 42/59/64
f 31/60/72 32/62/73 42/59/64
f 32/62/73 33/63/74 42/59/64
f 33/63/74 34/64/75 42/59/64
f 34/91/75 35/92/76 42/93/64
f 35/92/76 36/94/77 42/93/64
f 36/94/77 37/95/78 42/93/64
f 37/95/78 38/96/79 42/93/64
f 38/56/79 39/55/80 42/51/64
f 39/55/80 40/54/81 42/51/64
f 40/54/81 41/53/82 42/51/64
f 41/53/82 22/49/62 42/51/64

and the output object is here

v 5.44001 -1 -0.309017
v 5.29797 -1 -0.587786
v 5.07674 -1 -0.809017
v 4.79797 -1 -0.951057
v 4.48895 -1 -1
v 4.17994 -1 -0.951057
v 3.90117 -1 -0.809017
v 3.67994 -1 -0.587785
v 3.5379 -1 -0.309017
v 3.48895 -1 0
v 3.5379 -1 0.309017
v 3.67994 -1 0.587785
v 3.90117 -1 0.809017
v 4.17994 -1 0.951057
v 4.48895 -1 1
v 4.79797 -1 0.951057
v 5.07674 -1 0.809017
v 5.29797 -1 0.587785
v 5.44001 -1 0.309017
v 5.48895 -1 0
v 4.48895 1 0
v 5.44001 -1 -0.309017
v 5.29797 -1 -0.587786
v 5.07674 -1 -0.809017
v 4.79797 -1 -0.951057
v 4.48895 -1 -1
v 4.17994 -1 -0.951057
v 3.90117 -1 -0.809017
v 3.67994 -1 -0.587785
v 3.5379 -1 -0.309017
v 3.48895 -1 0
v 3.5379 -1 0.309017
v 3.67994 -1 0.587785
v 3.90117 -1 0.809017
v 4.17994 -1 0.951057
v 4.48895 -1 1
v 4.79797 -1 0.951057
v 5.07674 -1 0.809017
v 5.29797 -1 0.587785
v 5.44001 -1 0.309017
v 5.48895 -1 0
v 4.48895 1 0
vt 0.800609 0.153437
vt 0.853187 0.342951
vt 0.97054 0.500774
vt 0.982749 0.680535
vt 0.904224 0.836086
vt 0.768956 0.942029
vt 0.610931 0.994182
vt 0.454482 1
vt 0.313817 0.969889
vt 0.196085 0.912795
vt 0.104498 0.83501
vt 0.0405186 0.740541
vt 0.00520155 0.63205
vt 0 0.512002
vt 0.027181 0.384009
vt 0.0897402 0.254473
vt 0.190352 0.134527
vt 0.328514 0.0417729
vt 0.495176 0
vt 0.666179 0.0334716
vt 0.440147 0.545027
vt 0.662707 0.392667
vt 0.667107 0.492235
vt 0.707101 0.583524
vt 0.692675 0.673683
vt 0.636199 0.741562
vt 0.557346 0.778488
vt 0.473376 0.786261
vt 0.395457 0.771332
vt 0.32942 0.740458
vt 0.277778 0.698867
vt 0.241401 0.650034
vt 0.220556 0.596104
vt 0.215461 0.53851
vt 0.226552 0.478636
vt 0.254538 0.418524
vt 0.30017 0.361675
vt 0.363502 0.313891
vt 0.442283 0.283808
vt 0.529337 0.282144
vt 0.609973 0.31813
vt 0.440147 0.545027
f 1/1 20/20 2/2 
f 20/20 19/19 2/2 
f 19/19 18/18 2/2 
f 18/18 17/17 2/2 
f 17/17 16/16 2/2 
f 16/16 15/15 2/2 
f 15/15 14/14 2/2 
f 14/14 13/13 2/2 
f 13/13 12/12 2/2 
f 12/12 11/11 2/2 
f 11/11 10/10 2/2 
f 10/10 9/9 2/2 
f 9/9 8/8 2/2 
f 8/8 7/7 2/2 
f 7/7 6/6 2/2 
f 6/6 5/5 2/2 
f 5/5 4/4 2/2 
f 4/4 3/3 2/2 
f 1/1 2/2 21/21 
f 2/2 3/3 21/21 
f 3/3 4/4 21/21 
f 4/4 5/5 21/21 
f 5/5 6/6 21/21 
f 6/6 7/7 21/21 
f 7/7 8/8 21/21 
f 8/8 9/9 21/21 
f 9/9 10/10 21/21 
f 10/10 11/11 21/21 
f 11/11 12/12 21/21 
f 12/12 13/13 21/21 
f 13/13 14/14 21/21 
f 14/14 15/15 21/21 
f 15/15 16/16 21/21 
f 16/16 17/17 21/21 
f 17/17 18/18 21/21 
f 18/18 19/19 21/21 
f 19/19 20/20 21/21 
f 20/20 1/1 21/21 
f 22/22 41/41 23/23 
f 41/41 40/40 23/23 
f 40/40 39/39 23/23 
f 39/39 38/38 23/23 
f 38/38 37/37 23/23 
f 37/37 36/36 23/23 
f 36/36 35/35 23/23 
f 35/35 34/34 23/23 
f 34/34 33/33 23/23 
f 33/33 32/32 23/23 
f 32/32 31/31 23/23 
f 31/31 30/30 23/23 
f 30/30 29/29 23/23 
f 29/29 28/28 23/23 
f 28/28 27/27 23/23 
f 27/27 26/26 23/23 
f 26/26 25/25 23/23 
f 25/25 24/24 23/23 
f 22/22 23/23 42/42 
f 23/23 24/24 42/42 
f 24/24 25/25 42/42 
f 25/25 26/26 42/42 
f 26/26 27/27 42/42 
f 27/27 28/28 42/42 
f 28/28 29/29 42/42 
f 29/29 30/30 42/42 
f 30/30 31/31 42/42 
f 31/31 32/32 42/42 
f 32/32 33/33 42/42 
f 33/33 34/34 42/42 
f 34/34 35/35 42/42 
f 35/35 36/36 42/42 
f 36/36 37/37 42/42 
f 37/37 38/38 42/42 
f 38/38 39/39 42/42 
f 39/39 40/40 42/42 
f 40/40 41/41 42/42 
f 41/41 22/22 42/42 
1

There are 1 answers

0
Andrey On

It seems that the implementation of this algorithm without segmentation and packing, it's only LSCM solver. Try InstantUV SDK instead or implement the algorithm yourself. more about LSCM here: https://members.loria.fr/Bruno.Levy/papers/LSCM_SIGGRAPH_2002.pdf