Jump to content
UserNoah

[SOLVED] @P in Flip/POP Vexpression

Recommended Posts

Hello everyone,

 

I am currently working on something with FLIP Fluids and need to decrease the POP Windforce depending on the distance to a point. I assumed I could use the Vexpression inside the POP Wind but I can't seem to be able to access the particle Position.

I have created a basic HIP file. Inside the AutoDOP Network, you will find the POP Wind in which I'm simply trying to export a test attribute that should be "@P".

5f565a6f2f154_2020-09-0718_05_24-C__Users_noahh_Desktop_Position_in_Vexpression.hiplc-HoudiniIndieLimited-Com.jpg.7fbb03cd1127d582d0a0ed09f7d41d2e.jpg

 

I've already tried a couple of things like Google, reading the float values separately ("@P.x"), or simply using it like I would use VEX in SOPS ("float length = length(@P);"). I am sure there is an easy way that I haven't found yet or a logical reason why I can't access "@P".

 

Any help would be appreciated!

Position_in_Vexpression.hiplc

Edited by UserNoah
Added HIP File

Share this post


Link to post
Share on other sites

In my experience, not all node parameters are "writable" from a vexpression, but you can try by directly assigning to the name you see in the tooltip popup.

For this example, create a single point in your scene and reference it using the vex point function.

Us the fit to remap the minimum and maximum distance into a new wind value for your scene.

// Fetch point attribute from any node, anywhere.
vector p1 = point("../obj/geo_one_point/OUT","P",0);
float dist = distance(@P-p1);

// Remap distance into new wind Y range value.
float result = fit(dist,0,10, -0.5,-2);
windy = result;

 

Edited by Atom

Share this post


Link to post
Share on other sites
4 hours ago, UserNoah said:

I am sure there is an easy way that I haven't found yet or a logical reason why I can't access "@P".

it's just a false premise that you can't access @P, you definitely can so something like this is straightforward

wind *= length(@P);

 

the problem you are seeing is that you can't export your custom attribute like @test by default since it's not marked exportable inside of POP Wind

using export prefix is the way to go as you figured, however that just defines the default value of the attribute so you can't assign any variables to it like @P, what you can do however is this

export vector @test = 0;
@test = @P;

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you so much Tomas that did the trick (and something I would never have figured out by myself)!

I assumed that since I can't see my custom length attribute in the spreadsheet, that it couldn't work either. Good to know that it would have worked and even better to know how to export it properly!

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

×