Jump to content
Sign in to follow this  
Bandu

VEX SOP and local variables

Recommended Posts

Hi guys,

I'm doing a VEX SOP Geometry Operator and I'm wondering if there is a way to define my own Local Variables like $CEX $CEY $CEZ for example.

I want to be able to use them in my Parameter node if possible.

In detail, I needed different type of Scale Operator I wrote and it works fine.

I need to compute my geometry center in order to work it properly.

The only way I found is to type my previous transformation in Parameter node ( if the geometry is transformed ) and use this values inside VEX.

In Houdini Transform Operator I can type $CEX, $CEY, $CEZ to get the center of the object ( origin for scale ) or any values I like.

Now I need the same Local Variables for my Operator ( even $XMAX... $BBX... ) so it will compute them automatically inside my own Operator as soon as I write them in my parameter dialog.

Thanks,

Bandu

Share this post


Link to post
Share on other sites

hey

What about using the bounding box VOP, and using an average VOP between min and max,

use that as your centre ?

thats like using a centroid expression and passing those values into the vop context.

does this help?

Share this post


Link to post
Share on other sites

this method calculate always the center point, I want to use $XMAX, $BBX and all other variables and expressions using this variables, like is standard Houdini transfer node. At the same point it will allow me to create my own local variables if I only knew how to declare them.

Thanks anyway!

Share this post


Link to post
Share on other sites
this method calculate always the center point, I want to use $XMAX, $BBX and all other variables and expressions using this variables, like is standard Houdini transfer node. At the same point it will allow me to create my own local variables if I only knew how to declare them.

I think the only way to expose these as local variables is to write the OP using the HDK. VEX can create attributes and map them to variable names, but those would only be available further down the chain, not in the OP itself.

Share this post


Link to post
Share on other sites

One way that I found how to get that is

1. Create a box oriented to your input geo 

2. To create an attribute called BBX which their value is $BBX (or the axis of your choice) then in Attri VOP use a bind and call this last attribute

3. Use a multiply between "Cd" and "BBX", add a ramp to remap the color information

4. Voila, even if your geometry moves the ramp follows it, very usefulll to grade emitters or points or whatever you need. Hope it help you out.

Regards!

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
Sign in to follow this  

×