Search - User list
Full Version: procedurally delete point instances
Root » Solaris and Karma » procedurally delete point instances
mestela
I can see that I can manually delete instances with a modify point instances lop. Select stuff, turn on the ‘prune’ option, they delete.

I can also see that I can procedurally move instances by enabling ‘edit transform’, set the prims to /instancer1, set source to ‘internal sop’, move things inside the sop network, they move.

I can't see a way to procedurally delete instances. If I blast things in the sop network, they re-appear when I get back to lops. I tried using a collection lop to grab instances in a bounding box, but it doesn't appear to select anything. Had a peek in the hda, can see that the deletion stuff is separate from the transform stuff, but didn't delve much deeper than that, as I figure there must be an easier way I'm missing.

To be clear, this is about editing an existing instancer. Can't go the lazy way and edit at the source, these might be instancers setup earlier in the pipe, or from another app.

-matt
jsmack
If it's a point instancer, can you edit the points[]et al arrays using an attribute vop/wrangle?
Hamilton Meathouse
The following worked for me, but wasn't exactly as procedural as I'd like.

Modify Point Instances LOP, and in the Point Instances field, put
`lopinputprims('.', 0)`[0-100]
Tim Crowson
I'm curious about this too. Specifically, I'm interested in leveraging camera frustum bounds (e.g. %bound:/camera/mycamera) to remove point instances outside my field of view.
npetit
If you select "Internal SOP" as the method for pruning, dive in and delete the instances you want to be deleted or use a visibility SOP to hide the instances you want to be hidden.
Please let me know if that doesn't work for you.
Tim Crowson
Thanks, I'll give that a shot.
Dan_Andersen
Matt, I'm curious - what solution did you end up going with?

Cheers,
Dan
mestela
I don't remember! Eep!
Dan_Andersen
Ok, no worries

And, to make my comments not completely superfluous, we ended up hiding the points like this, which works for our needs (vex credit goes to a coworker):

int nums = usd_attriblen(0, @primpath, "positions");
int invisible[];
resize(invisible, nums);
for (int i = 0; i < nums; ++i){
    if (rand(i + ch("seed")) < ch("prune_amt"))
        invisible[i] = i;
    else
        invisible[i] = -1;
}

for (int i = nums-1; i >= 0; --i){
    if (invisible[i] == -1) removeindex(invisible, i);
}

i[]@invisibleIds = invisible;
Tim Crowson
Revisiting this now. I wanted to try using the Internal SOP to delete points outside camera frustum, but I'm not quite wrapping my head around it. Anyone have an example file maybe?
npetit
Hi Tim,

here's a quick example to get you going. If you dive inside the modify point instancers LOP you can toggle the switch between 0 to delete the instances outside the camera frustrum or 1 to hide them.

Hope that helps!
Tim Crowson
That's a super helpful example! Thank you!
Tim Crowson
I'm sure there is a simple adjustment I can make to fix this, but it's eluding me.... If I switch to operating on Points rather than Primitives and place the camera "in" the point cloud, the camuv bounds seem to extend past the back of the camera. How can I correct this to cull points behind the camera?

EDIT: Nevermind, I got it... just had to add @camuv.z>0 to the group list in my blast node.
Tim Crowson
Sorry to triple post, but I consistently get this warning with the ModifyPointInstances LOP, whether I'm working in the test scene provided above, or in a new scene entirely. Using 18.5.596. The node works, but keeps throwing this warning.
jsmack
Tim Crowson
The node works, but keeps throwing this warning.

The warnings look like version synchronization warnings. The file above was saved with version 18.5.672

The file gives me an idea for an RFE though. Could we get a usd/lops camera signature for toNDC/fromNDC?
Tim Crowson
Right, but I get this warning in a new scene built from scratch, with my local version.
jsmack
Tim Crowson
Right, but I get this warning in a new scene built from scratch, with my local version.

I don't have 596 installed, so I don't know if that's normal or not.

Edit:
I see it if I 'match definition' of the modify point instances node after unlocking. You can ignore it. I think it means the node was probably created in an earlier version of Houdini, and the nodes inside have changed since it was created.
Tim Crowson
Thanks, I logged a bug for this.
npetit
Hi Tim,

Build 18.5.680 should address this issue, as well as adding support for duplicating instances.
Tim Crowson
Nice, thanks so much!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB