Hi everyone,
Looking for any ideas on how to approach something like this:
Pixyz Studio #21 | How to automatically remove hidden entities in Pixyz Studio? [www.youtube.com]
I basically have a complex 3d model with a lot of inner parts and I want to delete the parts which are not visible from the outside.
Thanks
Delete geo inside geo
951 6 0- psychoboy852
- Member
- 16 posts
- Joined: 3月 2022
- Offline
- VortexVFX
- Member
- 48 posts
- Joined: 8月 2014
- Offline
Assuming you want to cull on a per-connected-mesh basis, rather than a per-point/primitive basis... you could perhaps start with the intersect vex command, make a check along the normal from each point in a mesh, store whether it hits anything or not... then use the promote note to aggregate the hits per mesh, convert number of hits into a percentage of total point count, and set a threshold to delete the whole mesh, say if 90% of intersect checks hit something, then delete that mesh.
Edited by VortexVFX - 2024年8月27日 12:30:37
Dan Wood
Vortex VFX Ltd
Vortex VFX Ltd
- psychoboy852
- Member
- 16 posts
- Joined: 3月 2022
- Offline
VortexVFX
Assuming you want to cull on a per-connected-mesh basis, rather than a per-point/primitive basis... you could perhaps start with the intersect vex command, make a check along the normal from each point in a mesh, store whether it hits anything or not... then use the promote note to aggregate the hits per mesh, convert number of hits into a percentage of total point count, and set a threshold to delete the whole mesh, say if 90% of intersect checks hit something, then delete that mesh.
Thanks Dan,
The intersect method is indeed working. If I use the wrangle with code on a single mesh (and plug other geo into second input) then it works perfectly, it finds all visible intersections along specified vectors. However as soon as I drag this wrangle into a for-each-piece loop something breaks. I feel like because the object itself is part of intersections check it basically hits itself. Is it possible to somehow remove the current piece from the group of meshes before plugging them all in for checking? Maybe it's easier to explain with file, here it is:
Image Not Found
- VortexVFX
- Member
- 48 posts
- Joined: 8月 2014
- Offline
Can't check over it myself at the moment, but I'm wondering if the group-expression version of the intersect command might be the way to go.
If you have each mesh assigned to a primitive group beforehand, you may be able to use a standard group pattern in that (string group) parameter... along the lines of "* ^thismesh" for intersecting everything excluding the current mesh.
int intersect(<geometry>geometry, string group, vector orig, vector dir, vector &p, vector &uvw)
If you have each mesh assigned to a primitive group beforehand, you may be able to use a standard group pattern in that (string group) parameter... along the lines of "* ^thismesh" for intersecting everything excluding the current mesh.
Edited by VortexVFX - 2024年8月28日 22:07:44
Dan Wood
Vortex VFX Ltd
Vortex VFX Ltd
- Aizatulin
- Member
- 495 posts
- Joined: 7月 2005
- Offline
There is also "intersect_all" function, which gives you all intersection along one ray. An innter point should have an odd number of intersections (no matter which direction). If you want to avoid self intersections you can remove current piece or you just add a small amount of the normal to push the point a bit away, so if the ray intersects the geo itself the additional count should always an even number.
Every point of the piece should be inside, so you can promote (point -> detail taking the minimum of an integer attribute for example), but this method will not work for every case. There are examples, where every point of a geometry is another, but there can be parts of surfaces, which are outside (just put a cube inside a torus).
If you want to be watertight, try boolean and if there is no intersection between the piece and the rest without piece, the piece should be completely inside.
Every point of the piece should be inside, so you can promote (point -> detail taking the minimum of an integer attribute for example), but this method will not work for every case. There are examples, where every point of a geometry is another, but there can be parts of surfaces, which are outside (just put a cube inside a torus).
If you want to be watertight, try boolean and if there is no intersection between the piece and the rest without piece, the piece should be completely inside.
Edited by Aizatulin - 2024年8月29日 01:58:26
- psychoboy852
- Member
- 16 posts
- Joined: 3月 2022
- Offline
Aizatulin
There is also "intersect_all" function, which gives you all intersection along one ray. An innter point should have an odd number of intersections (no matter which direction). If you want to avoid self intersections you can remove current piece or you just add a small amount of the normal to push the point a bit away, so if the ray intersects the geo itself the additional count should always an even number.
Every point of the piece should be inside, so you can promote (point -> detail taking the minimum of an integer attribute for example), but this method will not work for every case. There are examples, where every point of a geometry is another, but there can be parts of surfaces, which are outside (just put a cube inside a torus).
If you want to be watertight, try boolean and if there is no intersection between the piece and the rest without piece, the piece should be completely inside.
Hi! Thanks for sharing your test. I noticed that you've also included the "remove current iteration" in the loop. Thanks, for that, I wasn't sure how to do it.
Like you said, the "odd number of intersections" is tricky when there is a single plane or weird shape of a mesh. It's a really tricky task overall. A friend of mine had some success shooting rays from the outside into the inside. So he's spawning a sphere outside the object and counts if the face received a ray hit or not.
- Aizatulin
- Member
- 495 posts
- Joined: 7月 2005
- Offline
Sure ,
and yes you are right, you can't use this method if you have any geometry which which has open parts like a plane. You can't use boolean operations aswell. Shooting rays to multiple directions can be an option, but depending on the siuation, this method can also fail, if you have thin holes for example (where is low chance a ray will hit).
and yes you are right, you can't use this method if you have any geometry which which has open parts like a plane. You can't use boolean operations aswell. Shooting rays to multiple directions can be an option, but depending on the siuation, this method can also fail, if you have thin holes for example (where is low chance a ray will hit).
-
- Quick Links