Jump to content

Attribute Vs. Variable


Recommended Posts

Hi there,

I have a question about how houdini is getting the attributes.

If i have an object with one point attribute, in this case "p_pressure", how can I get the value of that attribute in the next node?

I know the "point" operation, and I know how to use it. The question is: why can't i use $P_PRESSURE?

Have I create an attribute node to do that?

I'm a little bit confuse about attribute and variables :)

thanks advance.

Link to comment
Share on other sites

The main issue is most nodes only has some (local) variables defined ($PT, $PT, $CY etc) but are unable to use others without using the point() or prim() functions.

If you create an attribute using an Attribute Create SOP, you can just use $P_PRESSURE. The Attribute Create SOP allows you to map the attribute to a varmap (I think it means variable map) which is accessible by other SOPs. Middle click on the Attribute Create SOP & you'll see the varmap attribute added.

It's not the clearest thing but you can think of attributes as data being attached to geometry & variables allow you to access those attributes.

Hope the above helps!

Cheers!

steven

Link to comment
Share on other sites

The main issue is most nodes only has some (local) variables defined ($PT, $PT, $CY etc) but are unable to use others without using the point() or prim() functions.

If you create an attribute using an Attribute Create SOP, you can just use $P_PRESSURE. The Attribute Create SOP allows you to map the attribute to a varmap (I think it means variable map) which is accessible by other SOPs. Middle click on the Attribute Create SOP & you'll see the varmap attribute added.

It's not the clearest thing but you can think of attributes as data being attached to geometry & variables allow you to access those attributes.

Hope the above helps!

Cheers!

steven

Yeah! it helps ;)

I thought that the point() function it was slower than an $variable, but I guess that I was just wrong.

I come from maya, and that kind of things are slower than a node conexion, so I have to change my mind.

Thanks!

Link to comment
Share on other sites

If you want, you can verify it with the Performance Monitor under the Windows menu. I'm referring to H9 here.

You can change the display flag on different SOPs (Point SOP, Attribcreate etc) & compare the timing difference. I'm sure we would all like to find out which method is more efficient.

Cheers!

steven

Link to comment
Share on other sites

Hey onesk8man,

There is a big difference between attributes and variables. Attribute is a piece of data attached to geometry. That thing which you call as variable is also attribute (detail). But variables (or local variables) are different thing. Most of operators create for us different local variables which are accessible only from this operator (that's why they called local). It's not because of the limitation of Houdini's architecture but rather because it's has no sense to try to get some of local variables outside of the current operator. For example does it has a sense to try to get the value of $CY of copy1 from expression of point1?

Concerning to variable mappings. We can use attributes in different ways. One way is to "sample" attribute using point(), primitive(), detail() functions. Another way is to create a variable mapping and use that name as a reference to attribute. How to create a variable mapping? Just create a detail attribute with the name "varmap" string type and with value name_of_attribute -> desired_name_of_variable. So the name of attribute and the name of mapped "variable" can be different. Attribute SOP does that mapping automagically. And also you can write the name of mapped variable in the Local variable field of AttribCreate SOP. If you looking for the fastest way to work with attributes you could use VEX.

Edited by hoknamahn
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...