Deleting overlapping primitives

   1267   2   0
User Avatar
Member
4 posts
Joined: 9月 2017
Offline
Hello I am using a points from volume to fill an object with a cube that has the bottom blasted out that is being copied using a copy to points node, I am having intersecting planes all over the bottom since the walls of the cubes touch each other. I tried using a clean sop and poly doctor but cant seem to get it working. Also I am not packing the geo when copying the cubes over. Any suggestions? Thanks

Attachments:
CapturePrim.PNG (1.5 MB)

User Avatar
Member
4515 posts
Joined: 2月 2012
Online
Hi,

After fusing your geometry, you can run 2 primitive wrangles like this:



Serialize point list:

string serializePointIndices ( int primIndex )
{
    int indices [ ];
    int count = primvertexcount ( geoself ( ), primIndex );
    for ( int i = 0; i < count; ++i )
    {
        int index = vertexpoint ( geoself ( ), vertexindex ( geoself ( ), primIndex, i ) );
        push ( indices, index );
    }
    indices = sort ( indices );
    return sprintf ( "%s", indices );
}

s@pointList = serializePointIndices ( @primnum );

Delete overlapping polygons:

string pointList = prim ( 1, "pointList", @primnum );
int count = findattribvalcount ( 1, "primitive", "pointList", pointList );
if ( count > 1 )
    removeprim ( geoself ( ), @primnum, 1 );

If you want to keep the first overlapping polygon rather than deleting all, you can do this:

string pointList = prim ( 1, "pointList", @primnum );
int index = findattribval ( 1, "primitive", "pointList", pointList );
if ( @primnum != index )
    removeprim ( geoself ( ), @primnum, 1 );
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
8551 posts
Joined: 7月 2007
Online
Fuse SOP
Clean SOP/Fix Overlaps
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links