Closed stla closed 1 year ago
Same issue with Rvcg::vcgUpdateNormals(mesh, type = 1)
(type 1 is the "angle weighted" way).
Could you post code to produce an example like this? (Hopefully for a simpler shape if you have one, but for that same shape if not.)
To me, that bad image looks closed, but with the normals messed up along that black line. But I can't tell that for sure. I think addNormals(angleWeighted=TRUE)
should be the default because it makes a better approximation in most cases, but clearly you've found an example where it doesn't work. That looks like a bug.
My guess would be that the mesh has an edge along that line, and the normal calculation is being messed up by that.
Just noticed that you're using version 1.1.3. This could be the same thing that was fixed in #373 . Were you getting those warnings you mentioned in #372 on this example? If you install the devel version using remotes::install_github("dmurdoch/rgl")
do you still see the problem?
I don't have a simpler shape and the code is a bit complex. I've just hosted a gist of this mesh, is it appropriate for you, or do you still want the code?
I tried Rvcg::vcgClean
and the mesh has no duplicated vertex, nothing "non clean".
No, there's no warning with this example.
If I do shade3d(mesh, color="red", back = "culled")
the result is very strange. But if I do shade3d(mesh, color="blue", front = "culled")
there's no weirdness. Does that mean the mesh is reversed?
yes, I think so, but consistently reversing shouldn't be a problem. Inconsistent orientation would be.
I've taken a look at the PLY file you posted. There's definitely some strange structure near the black line. For example, I did the following:
x <- mesh from the PLY file
x2 <- addNormals(x)
shade3d(x2, col = "red", back = "lines")
# rotate the surface so the black line is visible
f <- select3d() # Now select a very small part of the black line holding just a few vertices
vertices <- f(t(asEuclidean2(x$vb)))
# My selection included 2604 15905 16005 . I think 2604 came from the far side of the surface, but 15905 was on the near side
# Show only faces containing 15905:
keep <- apply(x$it, 2, function(tri) 15905 %in% tri)
x3 <- x
x3$it <- x$it[, keep]
open3d()
shade3d(x3, col = "red", back = "lines")
This gave me an image showing some very thin polygons with opposite orientation to the main one. That causes strange things to happen with the normals. (Sorry, I can't show the image; for some reason Github won't accept it.)
So I think addNormals
is behaving as designed, but the mesh you're working with behaves strangely along that line.
Thanks. I'm currently having a similar problem but this one is unrelated to the normals. There's a similar strange cut in my mesh, even without including the normals. I will investigate and what you did is inspiring me.
Hello,
I have this mesh, without normals:
Now I do
addNormals
:The mesh is not closed.
Now I do
addNormals
withangleWeighted=FALSE
:Smooth and closed.
I only recently discovered the option
angleWeighted
. And this is not the first time I get a "hole" when this option isTRUE
, but previously I didn't know this option and then I was lost.Therefore I'm wondering whether it would be better to set this option to
FALSE
by default.