procedurally delete point instances

   8468   19   7
User Avatar
Member
1737 posts
Joined: 5月 2006
Offline
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
Edited by mestela - 2020年5月19日 12:46:17
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
7741 posts
Joined: 9月 2011
Offline
If it's a point instancer, can you edit the points[]et al arrays using an attribute vop/wrangle?
Edited by jsmack - 2020年5月19日 13:53:39
User Avatar
Member
166 posts
Joined: 11月 2013
Offline
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]
Edited by Hamilton Meathouse - 2021年3月30日 21:56:42
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
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.
Edited by Tim Crowson - 2021年4月7日 22:27:08
- Tim Crowson
Technical/CG Supervisor
User Avatar
スタッフ
356 posts
Joined: 2月 2008
Offline
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.
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
Thanks, I'll give that a shot.
- Tim Crowson
Technical/CG Supervisor
User Avatar
Member
12 posts
Joined: 6月 2018
Offline
Matt, I'm curious - what solution did you end up going with?

Cheers,
Dan
User Avatar
Member
1737 posts
Joined: 5月 2006
Offline
I don't remember! Eep!
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
12 posts
Joined: 6月 2018
Offline
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;
Edited by Dan_Andersen - 2021年5月26日 06:42:17
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
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?
- Tim Crowson
Technical/CG Supervisor
User Avatar
スタッフ
356 posts
Joined: 2月 2008
Offline
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!

Attachments:
HidePIsByFrustrum.hip (221.0 KB)

User Avatar
Member
235 posts
Joined: 10月 2014
Offline
That's a super helpful example! Thank you!
- Tim Crowson
Technical/CG Supervisor
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
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.
Edited by Tim Crowson - 2021年9月1日 11:43:43
- Tim Crowson
Technical/CG Supervisor
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
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.
Edited by Tim Crowson - 2021年9月1日 11:47:24

Attachments:
loadwarning.PNG (61.8 KB)

- Tim Crowson
Technical/CG Supervisor
User Avatar
Member
7741 posts
Joined: 9月 2011
Offline
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?
Edited by jsmack - 2021年9月1日 11:51:57
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
Right, but I get this warning in a new scene built from scratch, with my local version.
- Tim Crowson
Technical/CG Supervisor
User Avatar
Member
7741 posts
Joined: 9月 2011
Offline
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.
Edited by jsmack - 2021年9月1日 12:00:03
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
Thanks, I logged a bug for this.
- Tim Crowson
Technical/CG Supervisor
User Avatar
スタッフ
356 posts
Joined: 2月 2008
Offline
Hi Tim,

Build 18.5.680 should address this issue, as well as adding support for duplicating instances.
User Avatar
Member
235 posts
Joined: 10月 2014
Offline
Nice, thanks so much!
- Tim Crowson
Technical/CG Supervisor
  • Quick Links