[Closed] which facets are visible?
Hey Uri,
are you in a hurry? I just uploaded a better version of the function, try it, works better and slightly faster. There’s an optional parameter to determine occlusion detection, but try first at 0, and increment by one if fails to deselect any occluded face. I’ll refine it and add comments in the next days.
Checking face center isn’t enough to determine whole face occlusion.
baFrontFaces -= #{aResult[2]}
means: subtract a BitArray with the single bit number aResult[2] from the BitArray baFrontFaces and assign the result to baFrontFaces. This expression is equivalent to:
baFrontFaces[aResult[2]] = false
means: set the bit number “aResult[2]” in the BitArray baFrontFaces equal to false.
- Enrico
i’ll try
though i think the face center check is what i need (even though its not as correct)
thanks
Hi Uri,
if you’re working with Editable Poly, face normals aren’t always obvious since polys are made of tri faces and the poly normal is the average of those normals. Maybe the unselected polys aren’t flat and the resulting normal points away from the camera for a very little angle, I’m just guessing. You can try the first function I posted here to see if it is a face orientation problem and not occlusion, you can try to adjust the threshold value too to see if selection changes. I cannot tell what’s going on without looking at the model.
- Enrico
Hi Uri,
my last function doesn’t work right in ortho views, I’m fixing it right now, but I’ve got strange results when I tried it on an Editable Poly modified by a noise. I’m trying to figure out what’s wrong.
EDIT: I found the issue. Current functions work only for flat polys. I’m going to modify the algorithm to make it work for the most general case.
- Enrico
Here they are. I just uploaded a new version of both functions. They’ve been revised and should work in every situation with Polys and Meshes, in Persp and Ortho viewports. The logic in the function to get non occluded faces by centers for Editable Polys has changed a little, now a poly is considered not occluded only if the centers of all the underlying triangles constituting it are not occluded. I hope it suits your needs.
- Enrico
p.s.
Richard was right, this wasn’t so trivial