Jump to content

Cleaning up the geo


reeson

Recommended Posts

Hi, can someone help me with cleaning up the geo. The thing is, after dividing the geo, I get some reverse/clipping on primitives. Also when I try to render to disk with ROP Alembic, I get a yellow warning about collision. Also when I import the .abc file into Octane, the geo has some artifacts. Here's my hip file. Cheers!

geo_clean.hip

Link to comment
Share on other sites

Yeah, none of the standard cleanup nodes will work for your case. You'll have to write code to detect the overlapping primitives, use the measure sop to determine their area and follow up with a removeprim function to remove the overlapping primitive with the smaller area.

Edited by Atom
Link to comment
Share on other sites

47 minutes ago, Atom said:

Yeah, none of the standard cleanup nodes will work for your case. You'll have to write code to detect the overlapping primitives, use the measure sop to determine their area and follow up with a removeprim function to remove the overlapping primitive with the smaller area.

Oh boy, I have some basic coding skills, but this way out of my league.

Link to comment
Share on other sites

Here is some basic code that I got to work, I placed both  for loop nodes in single pass mode. So only one section of the ring is processed. I haven't figured out to successfully integrate this code to loop over all the primitives in the full object, however.

This GIF shows what happens when I toggle the correction code on an off.

duplicate_prims.gif.9dc466badadd1d4a4f83e8ca7be40368.gif

It's a two step process, one step detects the overlap and marks the offending primitives, then the second wrangle node removes the marked primitives.

int is_x_same = 0;
int is_y_same = 0;
int is_z_same = 0;

// Get all primitives
int primitives[] = expandprimgroup(0, "*");

//foreach (int currentPrim; primitives){
    int currentPrim =11;
    vector cur_bbox = getbbox_size(0, itoa(currentPrim));
    float cur_area = prim(0,"area",currentPrim);
    //foreach (int testPrim; primitives){
        int testPrim =3;
        if(currentPrim!=testPrim){
            is_x_same = 0;
            is_y_same = 0;
            is_z_same = 0;
            vector test_bbox = getbbox_size(0, itoa(currentPrim));
            float test_area = prim(0,"area",currentPrim);
            if (cur_bbox.x==test_bbox.x) {is_x_same = 1;}
            if (cur_bbox.y==test_bbox.y) {is_y_same = 1;}
            if (cur_bbox.z==test_bbox.z) {is_z_same = 1;}
            int i = is_x_same+is_y_same+is_z_same;

            if (i>1) {
                // This primitive shares a parallel plane with the current prim.
                if(cur_area>test_area) {
                    setprimattrib(0,"should_remove",testPrim,1,"set");
                } else {
                    setprimattrib(0,"should_remove",currentPrim,1,"set");
                }
                // We have found a match so stop looping over test primitives.
                //break;
            }
        } else {
            // Skip testing against self.
        }
    //}
//}

 

ap_geo_clean_v3.hiplc

Edited by Atom
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...