AttribCreate basic help

   22079   66   2
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
After watching all tutorials on the internet that cover this node and reading the nodes documentation about twenty times, I'm still completly clueless about the AttribCreate node. I just don't understand how this works and especially how to use the created attributes.
Because I don't understand it, I can't judge about its power but meassured by the frequency I see it in use, it seems to be quite powerful so I would like to understand it.
Is there anybody able to explain this for dummies?
User Avatar
Member
4189 posts
Joined: June 2012
Offline
It applies an arbitrary attribute to the geo.
Edited by - April 3, 2014 21:23:24

Attachments:
AttribCreate.png (172.0 KB)

User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
Yeah, that's what I got so far but how to use these attributes?
And I don't really understand what gets stored in these attributes.
User Avatar
Member
4189 posts
Joined: June 2012
Offline
That value in spreadsheet is stored in the attribute.

You can use them, for example, as viscosity values I'd imagine in a dop simulation
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
But where and how?
How do I know when to use Vertex/Point/Primitiv/Detail and why is it actually called detail and what kind of geometry is that, I mean it probably shouldn't go any more detailed then vertices, should it?
There are so many questions in my head rotating I can't even keep track of all of them.
User Avatar
Member
4189 posts
Joined: June 2012
Offline
A mental-model of the primitive structure might help?

http://www.sidefx.com/docs/houdini13.0/model/attributes [sidefx.com]

I simply think of attributes like swing-tags on clothing, hanging off the parts
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
MartybNz
I simply think of attributes like swing-tags on clothing, hanging off the parts

Yes, that's the way Ari Danesh explains it in his tutorial and I understand the the basic idea but I don't know what to do with this swing-tag and how.

Exampletime:
I have a box and append an attribcreate. I call the attribute test, the class is point, type is float and the value I set to 5.
And now?…..
I don't know what to do with it now.
Where can I make use of these values and how?

And by the way, isn't the term Detail for the entire geometry not a prime example for weird naming convention, characteristic for Housini . I mean the last thing I would think of, hearing the term detail, is the whole.
User Avatar
Member
4515 posts
Joined: Feb. 2012
Offline
Yes detail is not the most intuitive name IMO. Global makes more sense IMO. I am sure it has a historical reason though
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
4189 posts
Joined: June 2012
Offline
Houdini detail's is just an individual item of the geo. Details in real life can always contain more details!
User Avatar
Member
4189 posts
Joined: June 2012
Offline
Korny Klown2
Where can I make use of these values and how?

Yes! You might say that could be a missing link in your thinking of AttributeCreate!

5 is an arbitrary figure with no purpose. Why did you make it 5?

Think of it as AtrributeCreate With Purpose!

In the attached file the box is animating, a group node groups points crossing over value 0 and then the pointcolour uses the value of the attribute create to colour those grouped points.


It would also be good if others could supply different examples too. Many ideas are good to learn from. Thanks!
Edited by - April 3, 2014 21:22:03

Attachments:
AttriTest2.hip (112.8 KB)
AttributeCreate5.png (103.3 KB)

User Avatar
Member
1390 posts
Joined: July 2005
Offline
Where can I make use of these values and how?
Anywhere (in any context), anytime with an expressions, VEX, VOPs, Python or particular node looking for a specific attribute or allowing you to pick custom one.

Your ‘test’ example can be used by ScatterSOP for example. It won't terrible exiting, because you made it constant across point's range, but let's change to to random per point (rand($PT)). Then in ScatterSOP: Alternate Attribute: test, Attribute Bias: 1, and you should see the result.


Attributes are geometry's qualities, so the question how to use them is ultimately the question what you want to do with geometry. Texturing? UV is the attribute. Rigging? Bones capturing skin is a set of attributes. Normals is attribute useful for rendering or orienting copies/instances, points' position and surface color are attributes, and even groups are attributes internally. Anything except topological structure is an attribute.

The only difference between Houdini and say, XSI is that Houdini can create and access an arbitrarily named attribute anywhere and anytime, with either expression or VEX, local variables, inside any context (SOPs, COPs, CHOPs, DOPs), unlike most applications which use attributes (or equivalents) to describe geometry qualities for a specific reason. In XSI weight maps can be used pretty much arbitrary in a similar fashon I suppose.

In essence attributes allows you to create custom properties of a geometry. What they are useful for, that up to you.
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
MartybNz
5 is an arbitrary figure with no purpose. Why did you make it 5?
Because I have no clue what I'm talking about and I just wanted to have an example to discuss with any number. I can't distinguish between “purpose” and “no purpose”.

MartybNz
It would also be good if others could supply different examples too. Many ideas are good to learn from. Thanks!
Probably, but the problem is that those who understand it, hardly can put themselves back into the shoes of someone who has no clue, so they come up with examples that are probably more confusing then helpful.
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
As was mentioned above, attributes allow you to add additional information on to any geometry component. Various operators if enabled can read these attributes either to do something or do something and change that attribute.

The position of a point or the P point attribute is by far the most important as it determines the position of the point. Every SOP knows how to read this attribute. It better! Some SOPs can read the P attribute and modify it like the Transform SOP, Point SOP, etc.

There are four attribute types:
Points (Vertices in other apps): lowest geometry data type in Houdini. Points are used to construct every geometry type. You can have just points and no primitives at all. This is why most times you will add attributes to points.

Primitives: Primitives are specific geometry types that add vertices which in turn reference points. There are many types of primitives in Houdini: Polygons, NURBs Curves/Surfaces, Volumes, Packed Primitives, etc. Each requires at least one vertex.

Vertices (Face Vertices in other apps): When constructing some primitive types such as Polygons, NURBs, Beziers or other surface geometry types, in order to construct a Primitive, new vertices are added referencing the points. These vertices are then used to construct the Primitive. The order in which the vertices are constructed on top of the points determines the Primitive Normal direction. I believe Houdini is Left handed (I always forget).

Detail: This is a special case attribute type unique to Houdini SOPs. A detail attribute rides on top of the geometry and is passed from SOP to SOP.

It is imperative that you use the MMB on any SOP tile to see what it contains or what it has cooked. One of the blocks in that MMB information contains a list of all the attributes on the geometry on that SOP.

Using the Geometry Spreadsheet Details View is important to see these attributes. You can see the Point attributes, Vertex attributes indexed by prim_num:vertex_num and the very first column with vertices is the point number that it references (read above as to why), then the primitive attributes. Then there is the Details list.


Uses for Geometry Attributes
Many geometry attributes are required for rendering. Rendering in the viewport with OpenGL or rendering in Mantra. Texture Co-ordinates are one such attribute. They are used to index in to a texture map from 0-1 in both u and v directions.
In Houdini, you can create two types of UV Texture Co-ordinate attributes: point or vertex. These days I don't bother with point UV's but go straight to vertex UV's which support seams on closed geometry far better. Actually that is the very reason vertex UV's are supported. Remember point attributes are the base data type upon which primitives are constructed. Vertices are then constructed on top of the points. If you have 4 polygons sharing a single point, you will find 4 vertices referencing that point, one vertex per primitive. This means that at UV seams, you can have one vertex set to 1 and the other set to 0 and get a proper seam. Meanwhile the point can only have one uv attribute, either 0 or 1. Not good for seams.


If you want to learn about the default attributes, those that Houdini defines and many SOPs know about, you can use each of:
Point SOP
Vertex SOP
Primitive SOP
and no there is no Detail SOP so in order to create these you need to use the Attribute Create SOP.

As you add new attributes, you can MMB on the SOP to see that they are present and as to what type they are and the Geometry Spreadsheet to see what values are stored.

Another attribute, the Color or Cd attribute can also be of type Point, Vertex or Primitive and all three will work. Well all three will work with a precedence order of Point over Vertex over Prim over Detail. And this is wrt Mantra and the Viewport OpenGL renderer. So if you have a Cd attribute on all four, Points will win.

Same for Alpha.

As for constructing ad-hoc attributes, this is quite common now. The Fur tools are an excellent example of utilizing point and vertex attributes to affect how the fur is generated. Just roll through the various presets on the Fur Tools and see what SOPs are placed and what attributes are generated.
These attributes are referenced by the Fur Procedural and more specifically the two cvex VOP context networks that read and write to these attributes.

Another critical use of geometry attributes has to do with VOP/VEX and rendering. You can add any geometry attribute by name and type, then by using a Parameter VOP or a Bind VOP inside your VOP network, you can read that attribute directly to affect your shading of your geometry. You can add float disp_amp and then in a Material VOP network, use a Bind VOP or Parameter VOP with the name set to disp_amp and of type float and voila, you now read that attribute on the surface of the geometry to affect your displacement amount if you wire this in to a Multiply VOP fed in to a Displace Along Normal VOP.

Many users abuse attributes. Adding a vector point attribute just added the equivalent of another copy of the geometry if you think about it. If you are really pushing the limit of memory, start stripping those attributes you don't need.

Ultimately it's the task at hand and your imagination as to how to attack the problem and get the shot out. It's important to be able to read a SOP network and follow the attributes as they are created and used as they carry and retain information from previous operations to be used in future operations.

Use the Help
Every SOP has a help card. Use it! It will list what local variables and what attributes this operator will read and use.
Many DOP solvers and generators list attributes that if present on the geometry will be used by that solver.

Every power user uses the help. Period. No excuses. It works. It's designed to quickly reference those attributes and plow ahead.
There's at least one school like the old school!
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
jeff
Use the Help
Every SOP has a help card. Use it! It will list what local variables and what attributes this operator will read and use.
Many DOP solvers and generators list attributes that if present on the geometry will be used by that solver.

Every power user uses the help. Period. No excuses. It works. It's designed to quickly reference those attributes and plow ahead.

Sometimes I still use the help but I mostly gave it up because all these variables and such, are not really well implemented in Python so I don't care. If Houdini is only usable with HScript, I don't want it and if these attributes can only be accessed by HScript, I don't care about them either. And with “only” I mean “in Python you need a rediculously long convert function”.
But anyway….I appreciate your efforts.
User Avatar
Member
4189 posts
Joined: June 2012
Offline
Korny Klown2
Probably, but the problem is that those who understand it, hardly can put themselves back into the shoes of someone who has no clue, so they come up with examples that are probably more confusing then helpful.

No probs - so we go back to the start - can you tell us what is your understanding of an attribute?
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
I do understand that I can create attributes on vertices/points/prims/detail that I can then use later down the stream.
1. I don't know when to use which component type
2. I have no practical example in my mind where I would need this functionality.
3. I don't understand what is going on there.

Here [youtube.com] he creates the attribute primnum and assigns $PR to the value. So now every primitive has an attribute with its own index as value. Later he appends a foreach SOP and uses this attribute in the Attribute parameter. Here I don't understand what is going there. If you would read this foreach node as plain english it says: For each attribute value execute what is in this foreach node, in this case an extrusion. Well the attribute values are 0, 1, 2, 3, 4, 5, 6, 7… How is this foreach node able to extrude the numerical values 0, 1, 2, 3….This makes no sense unless the attribute would have stored the primitives themselves but as far as I understand it it just stores numerical or string values so, what is going on there. And by the way, between the attributecreate SOP and the foreach SOP there is a subdivide SOP, shouldn't the primindexes change? And what i also don't understand when to use the attributes name and when the local variable. This is so mixed up and confusing to me. And in addition to that, not that this is not enough, there is also all this HScript you have to struggle with like a ball and chain.
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Korny Klown2
all these variables and such, are not really well implemented in Python so I don't care. If Houdini is only usable with HScript, I don't want it and if these attributes can only be accessed by HScript, I don't care about them either. And with “only” I mean “in Python you need a rediculously long convert function”.

Why is that ? :shock: Pretty much all major apps use custom dialect for expressions. Surely Python isn't the best choice for parameters evaluation - for a performance reasons and verbosity. That's why we still have hscript around.

I don't think it can be any easier than that unless someone doesn't want to try at all.

hscript: sin(ch(“/obj/cube/tx”)
python: sin(ch(“/obj/cube/tx”))
XSI: sin( cube.kine.local.posx )

?
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Korny Klown2
he creates the attribute primnum and assigns $PR to the value. So now every primitive has an attribute with its own index as value. Later he appends a foreach SOP and uses this attribute in the Attribute parameter. Here I don't understand what is going there. If you would read this foreach node as plain english it says: For each attribute value execute what is in this foreach node, in this case an extrusion. Well the attribute values are 0, 1, 2, 3, 4, 5, 6, 7… How is this foreach node able to extrude the numerical values 0, 1, 2, 3….

ForeachSOP allows you to execute an action on each part of a geometry based on some criteria. In that case, it simply deletes all primitives with the attribute value other than currently proceeded. In plain English: for every distinct attribute value do something - but only with the part of a geometry, that holds that value.

And by the way, between the attributecreate SOP and the foreach SOP there is a subdivide SOP, shouldn't the primindexes change?

This is exactly the reason why primnum was created: to allow selecting subdivided geometry based on it's pre-subdivided primitives numbers. SubdivideSOP intelligently assigns to new polygons its parent's attributes values.

And what i also don't understand when to use the attributes name and when the local variable.

It's completely up to you. Local variables are only convenient shortcuts to attributes. Their drawback is… well, they are local, that is not always accessible, unlike attributes which are always there once created.

This is so mixed up and confusing to me. And in addition to that, not that this is not enough, there is also all this HScript you have to struggle with like a ball and chain.

I can understand that. Does it [sidefx.com]help?
User Avatar
Member
210 posts
Joined: Jan. 2014
Offline
SYmek
I don't think it can be any easier than that unless someone doesn't want to try at all.

hscript: sin(ch(“/obj/cube/tx”)
python: sin(ch(“/obj/cube/tx”))
XSI: sin( cube.kine.local.posx )

But it also couldn't be more complicated then

HScript: $OS
Python: set a keyframe + hou.expandString('$OS')
What is so difficult about
Python: os() (and of course autodetect the expression)
I don't understand why it is perfectly possible that a parameter automatically detects an HScript expression but doesn't autodetect a Python expression.
Edit:
What makes this even more confusing that some Python function get automatically detected and some not.
I just typed frame() into the sizex parameter and it workes perfectly fine, I don't even have to manually set a kexframe at first so why do I have to manually set a key and then type hou.expandString('$OS') to get the same functionality as $OS. The question is, why is there a perfect working equivalant to $F (frame()) but no equivalent to $OS (os()). I mean the technologie is there….


SYmek
ForeachSOP allows you to execute an action on each part of a geometry based on some criteria. In that case, it simply deletes all primitives with the attribute value other than currently proceeded. In plain English: for every distinct attribute value do something - but only with the part of a geometry, that holds that value.

So the geometry does indeed gets stored with the values?


SYmek
This is exactly the reason why primnum was created: to allow selecting subdivided geometry based on it's pre-subdivided primitives numbers. SubdivideSOP intelligently assigns to new polygons its parent's attributes values.
How do I know that this node is so intelligent? This behaviour is not documented in the help, that leaves me guessing what a node is capable to do.
User Avatar
Member
1390 posts
Joined: July 2005
Offline
Korny Klown2
But it also couldn't be more complicated then

HScript: $OS
Python: set a keyframe + hou.expandString('$OS')
What is so difficult about
Python: os() (and of course autodetect the expression)
I don't understand why it is perfectly possible that a parameter automatically detects an HScript expression but doesn't autodetect a Python expression.

I hear you. Python in parameters is a long standing issue, I'm usually not conscious of it, because I hardly use Python here. But there is a little confusion in your post, so I'll try to explain. See bellow.

BTW you can use pwd() as a stand for $OS… which comes from hou.pwd() returning current operator in Python. Like ch(), parm(), etc these common methods are imported into parameter's namespace. See Help [sidefx.com]for more details on that. Houdini couldn't use os() perhaps because os is one of the most commonly used module [docs.python.org]in Python if not for other reasons.

BTW2 single Alt+LMB for setting keyframe/toggling Python expression isn't that bad after all

What makes this even more confusing that some Python function get automatically detected and some not.
I just typed frame() into the sizex parameter and it workes perfectly fine, I don't even have to manually set a kexframe at first so why do I have to manually set a key and then type hou.expandString('$OS') to get the same functionality as $OS. The question is, why is there a perfect working equivalant to $F (frame()) but no equivalent to $OS (os()). I mean the technologie is there….


Because you put frame() into numeric parameter, where things are simple: anything which is not a number is an expression.

Contrary to this you use $OS in string parameter, so Houdini can't know if a string you have just typed has to be treated literally or as an expression to evaluate. $OS isn't expression per se, if it was, you would have to use back-tick to evaluate it like: `expression()`.

$ at the front of $OS says: I'm a local/global variable, not a string. Type \$OS to turn it into a string and see how Houdini doesn't know what to do with that.

The problem is that back-ticks don't work with Python, that's why set keyframe is used instead as I suppose.


SYmek
ForeachSOP allows you to execute an action on each part of a geometry based on some criteria. In that case, it simply deletes all primitives with the attribute value other than currently proceeded. In plain English: for every distinct attribute value do something - but only with the part of a geometry, that holds that value.

So the geometry does indeed gets stored with the values?

Sorry I didn't get that?

SYmek
This is exactly the reason why primnum was created: to allow selecting subdivided geometry based on it's pre-subdivided primitives numbers. SubdivideSOP intelligently assigns to new polygons its parent's attributes values.
How do I know that this node is so intelligent? This behaviour is not documented in the help, that leaves me guessing what a node is capable to do.

If you apply a varying color to a mesh and start changing topology by inserting new primitives (polygons), they usually get color from neighboring polys, right? In any software there is… This is the same behavior. Houdini is very consistent in that manner. It inherits or interpolates any attribute present on a geometry. At least it never deletes anything.
Edited by - April 3, 2014 21:20:11
  • Quick Links