How could I delete overlapping primitives?

   14743   10   5
User Avatar
Member
27 posts
Joined: July 2005
Offline
Hi all,
As a very simple example, suppose I have 2 boxes aligned side by side (no gap between them) and merged with a merge sop, the resulting geometry will have 2 primitives overlapping each other.

How can I get rid of these overlapping primitives so that i have a hollow geometry? Basically what I want to do is to merge a few objects into one piece.



Wesley
User Avatar
Member
7 posts
Joined: Jan. 2007
Offline
The Cookie tool should work, but I believe you can only use it on polygons.
I may be wrong, I'm quite new.

Although if you have two boxes right next to each other, why not just make one box instead?
User Avatar
Member
27 posts
Joined: July 2005
Offline
ah…….yes~ How come I could forget the cookie sop, …thanks elias~!
after the cookie, then append a clean sop or (fuse sop then delete sop).

Wesley
User Avatar
Member
1 posts
Joined: Feb. 2019
Offline
Has the name of the “cookie” sop changed?
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
it's replaced by boolean node
User Avatar
Member
7762 posts
Joined: Sept. 2011
Offline
A boolean is unnecessary for this type of operation. Assuming the points of the overlapping face are all in fuse distance, use a Clean SOP with “consolidate points” and “fix overlaps” enabled.
Edited by jsmack - July 30, 2019 22:45:27
User Avatar
Member
408 posts
Joined: June 2015
Offline
jsmack
A boolean is unnecessary for this type of operation. Assuming the points of the overlapping face are all in fuse distance, use a Clean SOP with "consolidate points" and "fix overlaps" enabled.

This does not work for me. I have several curves with overlapping edges, and i can't find a simple way to get rid of the overlapping bits in order to fuse the points together and keep a single curve. Any other approach that would be effective on curves please?

Cheers,

A.
User Avatar
Member
8549 posts
Joined: July 2007
Online
Adriano
jsmack
A boolean is unnecessary for this type of operation. Assuming the points of the overlapping face are all in fuse distance, use a Clean SOP with "consolidate points" and "fix overlaps" enabled.

This does not work for me. I have several curves with overlapping edges, and i can't find a simple way to get rid of the overlapping bits in order to fuse the points together and keep a single curve. Any other approach that would be effective on curves please?

Cheers,

A.
Fuse + Convert Line + Poly Path
even though Convert Line may not be necessary, try without
Edited by tamte - Oct. 10, 2022 19:12:39
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
4512 posts
Joined: Feb. 2012
Offline
After fusing 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
475 posts
Joined: July 2005
Offline
If you add all points (from every other prim) to a prim, where the distance is very close to zero, this should work for overlapping prims aswell, where the points are not in fuse distance (polyline only). I'm not sure, if there is an inbuild node.

Attachments:
add_all_intersecting_points.hipnc (211.0 KB)

User Avatar
Member
233 posts
Joined: March 2009
Offline
Great info!
  • Quick Links