Jump to content

Get input to DOP Network in POP wrangle

Recommended Posts

Hi all. This should be easy, but it's killing me...


I have a control object living outside a DOP network, a simple particle system. I've plugged it into the second input.


Inside the DOP I access this control position without issue, in a VOP. However I then want to follow up by killing particles in a POP wrangle, based on distance to the control object...


Easy right? Here's my vex:

f@dist = distance(@P, v@opinput0_P);

if ( @dist <= ch("threshold")) {

... simple. But it kills particles around the origin, not the control object, as if v@opinput0_P = {0,0,0}

I've tried multiple variants on opinput, explicit path and the point function etc but it always gives me a "kill" radius around the origin, not the control object.

Anyone see what I'm missing?

Thanks in advance!

Edited by Matic3D

Share this post

Link to post
Share on other sites

if you do not post your .hip I'm not what you are doing but one way to do it is using the proximity pop node. 

Here you go.





  • Like 1

Share this post

Link to post
Share on other sites

Sepu, yes that does exactly what I'm trying to do. Interesting. Thank you! >bow<

I'm still interested why the proximity POP is necessary however.

Shouldn't this be possible with that single wrangle? It it necessary to get the control object's transform or something rather than "P"? Any wizards out there see what's missing?


Share this post

Link to post
Share on other sites

Hello Matic3D,

I made the changes as per your request: kill_MOD.hip

First of all thumbs up to Sepu, for doing a great job. It's the easiest fix for such a problem and it's always a good practice to keep things simple because I believe, as the sim gets more complex, it gets difficult to keep track of all the complex setups that we implement.

But I see that you wanted more data pulled from the control object into the sim. So, I modified Sepu's file a little bit. I got rid of the proximity pop node and inserted that functionality into the pop wrangle. I also changed how the threshold works. Now it gets that value from the control object. I assume something like this is what you were after.

Here is how it's done:

In the POP wrangle under the Inputs tab, I changed the input 2 to second context geometry. I have also set a controller for threshold in the SOPs level. So, now the POP wrangle now gets data from the second input connected to the DOPNET, which in our case is the control object.



Now let's take a look at the code. The first two lines pull the data from our control object. Here I imported the position and threshold values into the variables pos and threshold respectively. Please note that I have used the point function for this. This is because if you take a look at the geometry spreadsheet with the control object selected, you can see that it's a point and it has both position and threshold values as attributes.

Now why "point(1, "P", 0)" ?  The 1 tells Houdini that I want to use the second input (In Houdini 0 means first input, 1 means second input and so on..) to get the data from, which is the control object. Since there is only one point coming from the control object I put 0 as the last argument to the point function.

In the third piece of code, I calculate the distance of the points from the control object using the distance function and store this value inside a variable called neardist.

Finally, in the last few lines, I compare the distance stored in the neardist variable to the value stored in the threshold and deletes points based on that calculation.


Using this technique you can pull any data from the control object and use it in DOPS. Even if the control object's parameters change, it's still reflected in your simulations. Now let's imagine you have multiple points in your control object, then all that is required is to put the code in a loop and check for all the points in the control object. As you can see, the possibilities are basically endless.

I hope this answers your question



Edited by Eyeracker
  • Like 1

Share this post

Link to post
Share on other sites

Wow that's fantastic, exactly what I was looking for. This example helps because eventually I'll need to pull in a lot of attributes from the SOP level. Thank you both!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now