Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduced artifacts when remeshing #158

Open
actondev opened this issue May 23, 2023 · 2 comments
Open

Introduced artifacts when remeshing #158

actondev opened this issue May 23, 2023 · 2 comments

Comments

@actondev
Copy link

Describe the bug
I stumbled upon a weird behavior when remeshing, when some weird flipped face artifact was introduced. It seems that calling detect_boundary before remeshing (either with pmp::adaptive_remeshing or with pmp::uniform_remeshing) causes the issue.

To Reproduce
Steps to reproduce the behavior:

const auto triangleEdgeLength = 0.5;
const auto algorithmIterations = 10;

std::filesystem::path in("input.obj");
pmp::read(mesh, in);
pmp::detect_boundary(mesh); // when this is commeted out, the issue is not present, however the remeshed mesh is not the desired one
pmp::uniform_remeshing(mesh, triangleEdgeLength, algorithmIterations, true);
std::filesystem::path out("remeshed.obj");
pmp::write(mesh, out);

The input.obj file:

# OBJ export from PMP
v -0.1982631236 3.4977140427 0.0000000000
v -1.3179311752 -1.3247808218 0.0000000000
v -0.3942996562 -2.1346323490 0.0000000000
v -0.8907890916 -1.5538849831 0.0000000000
v 1.6485068798 -2.1434488297 0.0000000000
v -1.0580925941 -1.0284365416 0.0000000000
v 2.0331587791 -0.4867242575 0.0000000000
v 0.8612220883 0.2289074957 0.0000000000
v 0.7864076495 1.0752063990 0.0000000000
v -0.6645965576 -0.5796559453 0.0000000000
v -0.6070595980 0.9520211816 0.0000000000
v -0.1982631236 3.4977140427 0.0000000000
f 11//11 1//1 2//2
f 2//2 3//3 4//4
f 4//4 5//5 6//6
f 6//6 7//7 8//8
f 8//8 9//9 10//10
f 10//10 11//11 2//2
f 2//2 4//4 6//6
f 6//6 8//8 10//10
f 10//10 2//2 6//6
The remeshed.obj file with the face artifact
# OBJ export from PMP
v -0.1982631236 3.4977140427 0.0000000000
v -1.3179311752 -1.3247808218 0.0000000000
v -0.3942996562 -2.1346323490 0.0000000000
v -0.8907890916 -1.5538849831 0.0000000000
v 1.6485068798 -2.1434488297 0.0000000000
v -1.0580925941 -1.0284365416 0.0000000000
v 2.0331587791 -0.4867242575 0.0000000000
v 0.8612220883 0.2289074957 0.0000000000
v 0.7864076495 1.0752063990 0.0000000000
v -0.6645965576 -0.5796559453 0.0000000000
v -0.6070595980 0.9520211816 0.0000000000
v -0.1982631236 3.4977140427 0.0000000000
v -0.4026613533 2.2248675823 0.0000000000
v -0.7580971718 1.0864665508 0.0000000000
v 0.1011266708 -0.8252944350 0.0000000000
v -0.8561154008 -1.7297065258 0.0000000000
v -0.6425443888 -1.8442586660 0.0000000000
v 0.3788588941 -1.8486669064 0.0000000000
v 0.2952071428 -1.5859427452 0.0000000000
v 0.4875330925 -0.7575803995 0.0000000000
v 1.4471904039 -0.1289083809 0.0000000000
v 0.1551957279 -0.1203270555 0.0000000000
v 0.8238148689 0.6520569324 0.0000000000
v 0.0609055459 0.2477752268 0.0000000000
v 0.6335320473 -1.7253192663 0.0000000000
v -0.6358280778 0.1861826181 0.0000000000
v -0.6181386709 1.6892784834 0.0000000000
v -0.3004622459 2.8612909317 0.0000000000
v -1.0380141735 -0.1191571355 0.0000000000
v -0.1212951839 -0.5088999867 0.0000000000
v 1.0136828423 -1.9960578680 0.0000000000
v -0.3814427257 -1.3071897030 0.0000000000
v 1.2603459358 -0.6221523285 0.0000000000
v 1.1542062759 0.0499995574 0.0000000000
v 0.8739395142 -0.6898663640 0.0000000000
v -0.3018454909 -0.1659403592 0.0000000000
v -0.0431177914 -1.4465662241 0.0000000000
v -0.6214438677 0.5691019297 0.0000000000
v -0.5048604608 1.5884443521 0.0000000000
v -0.8980556726 0.4836547077 0.0000000000
v -0.4781801403 2.2920904160 0.0000000000
v -0.6716861725 -0.9607225060 0.0000000000
v 1.3101819754 -2.0040721893 0.0000000000
v -0.3382216394 2.8949022293 0.0000000000
v -0.2559651136 -1.7012759447 0.0000000000
v 1.6467523575 -0.5544382930 0.0000000000
v 0.9718570113 -1.8646957874 0.0000000000
v -0.2852797508 -0.8930084705 0.0000000000
v 0.7136108875 -0.3941425681 0.0000000000
v 1.7401745319 -0.3078163266 0.0000000000
v 1.0928871632 -0.3541852534 0.0000000000
v 0.5781729817 -0.0717795715 0.0000000000
v 0.3110318184 -0.4487698972 0.0000000000
v -0.6502122879 -0.1967366636 0.0000000000
v 0.4236565828 0.6614907980 0.0000000000
v -0.7197676897 -1.1678130627 0.0000000000
v -1.1779726744 -0.7219690084 0.0000000000
v 0.4780529737 0.2736637592 0.0000000000
f 54//54 29//29 57//57
f 4//4 16//16 17//17
f 56//56 6//6 2//2
f 34//34 8//8 52//52
f 36//36 10//10 30//30
f 11//11 40//40 38//38
f 56//56 2//2 16//16
f 39//39 27//27 14//14
f 55//55 24//24 58//58
f 22//22 30//30 53//53
f 44//44 28//28 1//1
f 52//52 53//53 49//49
f 42//42 48//48 10//10
f 16//16 4//4 56//56
f 3//3 17//17 16//16
f 48//48 15//15 30//30
f 43//43 31//31 5//5
f 53//53 52//52 22//22
f 7//7 50//50 46//46
f 52//52 49//49 34//34
f 47//47 25//25 18//18
f 58//58 8//8 23//23
f 55//55 23//23 9//9
f 45//45 37//37 32//32
f 27//27 13//13 41//41
f 57//57 42//42 10//10
f 2//2 6//6 57//57
f 14//14 11//11 39//39
f 8//8 58//58 52//52
f 30//30 22//22 36//36
f 48//48 30//30 10//10
f 26//26 40//40 29//29
f 49//49 51//51 34//34
f 19//19 37//37 45//45
f 35//35 51//51 49//49
f 51//51 35//35 33//33
f 53//53 30//30 15//15
f 47//47 18//18 31//31
f 11//11 14//14 40//40
f 41//41 13//13 28//28
f 22//22 52//52 58//58
f 26//26 38//38 40//40
f 36//36 22//22 24//24
f 27//27 39//39 13//13
f 10//10 54//54 57//57
f 31//31 43//43 47//47
f 56//56 4//4 32//32
f 32//32 4//4 45//45
f 28//28 44//44 41//41
f 33//33 46//46 50//50
f 57//57 6//6 42//42
f 29//29 54//54 26//26
f 58//58 24//24 22//22
f 45//45 18//18 19//19
f 55//55 58//58 23//23
f 19//19 18//18 25//25
f 15//15 20//20 53//53
f 20//20 49//49 53//53
f 49//49 20//20 35//35
f 33//33 50//50 21//21
f 21//21 51//51 33//33
f 34//34 51//51 21//21

Expected behavior
No new faces should be introduced and definitely not flipped faces!

Screenshots
From left to right: the input mesh, remeshed without the detect_boundary call, remeshed with detect_boundary: you can notice the face artifact int red (it's also a flipped face with opposite normal)
image

Close up of the face artifact:
image

Environment (please complete the following information):

  • OS: macOS
  • Compiler:
  • Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  • Target: arm64-apple-darwin22.4.0
  • Thread model: posix
  • Build type: Release
@dsieger
Copy link
Member

dsieger commented May 23, 2023

Thanks for reporting, I could reproduce the issue. Might be something with the tangential smoothing. I'll look into it. Quick workaround for the concrete case: try a smaller edge length (0.4 seems fine).

@actondev
Copy link
Author

Just FYI, I was trying with latest main branch b0cc214 (because I saw some commits about remeshing) but the issue is still there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants