-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Difference between linearly extruded polygon and polyhedron generates incorrect surface #4325
Comments
Hints for bug reports:
With respect to the missing faces... This one is a new one on me. Your beam_head_cut_impl3 polyhedra have reversed faces. Faces should always have their vertexes listed clockwise, as viewed from outside the polyhedron. Normally reversed faces are only a problem for full F6 render, but they apparently throw difference() for a loop too. Here's a very simple demonstration, differencing two cubes where one of them is a polyhedron with one face reversed.
In your beam_head_cut_impl3 objects, some of the faces are backwards. Get rid of all of the coloring, and use the "Thrown Together" view. You want to see all yellow faces. Any purple faces are bad. Usually, fixing that is just a matter of reversing the vertex list, but the way that you've constructed the two polyhedra, one is inside-out from the other. I haven't tried to deeply understand how you are constructing those polyhedra, but a brute force answer is to first get one of them correct, and then reverse the vertex lists for the other. Here's a face list that gets the top object to be correct:
Here's a pair of functions that will reverse vertex lists:
And here's the invocation:
|
This fixes your problem
|
Thanx for the tip! I didn't know that only that mode wrong normals can be visualized, my expectation were that wrong normals cause face to vanish in preview mode .. O_o I fixed the code as suggested, but there is still that Z-fight left for cut surfaces.
|
With respect to the Z-fighting... The previewer really hates coincident faces that are different colors - even if those coincident faces have been cut away. (This makes perfect sense if you look at how the previewer works under the covers... but doesn't make much sense if you don't.) Here's a simple demonstration, cut down from your example:
So what can you do about it? Avoiding the coincident faces isn't practical here. But you can (at some performance cost in some cases) work around it by slapping a render() around the difference:
That takes the differencing out of the hands of the previewer and puts it into the hands of the full renderer, which will well and truly get rid of the subtracted-away parts of the object. |
Another workaround is to make the faces be just a teensy bit non-coincident. Make the beams be just a little shorter. This seems to be enough:
Of course, there you're actually modifying the model, and that's not really desirable. But sometimes it's OK. |
The attached piece of code demonstrates beams with cut heads, but unfortunately there are two issues visible
The text was updated successfully, but these errors were encountered: