How to ensure a vector stays rotated with geometry

   2195   4   1
User Avatar
Member
134 posts
Joined: Sept. 2021
Offline
Hi!



I have this grid which was originally flat in the xz plane and I added normals to it such that the normal was parallel with the y axis. I then used a primitive wrangle to add a vector attribute to the primitive called "other_vector" which is also parallel to the y axis. Then, I drop down a transform node to rotate the grid. The normal vector was rotated with the transform node, but the other vector which I created wasn't. Is there a way that I can lock my vector attributes to the geometry just like the normals are locked to it?

(This is a simplification of what I need to do; in my real application the transformations on the geo will be more complex than a transform node, it will include rotating and translating geometry by copying it to points and things like that

Attachments:
2023-06-06_09-08.png (949.0 KB)

User Avatar
Member
542 posts
Joined: Nov. 2016
Offline
A simple way to do it is to first create your attribute using an attribute create sop. You can specify that your attribute is indeed a vector (transformed) and not a float of size 3 (not transformed).

If you want more control, look up setattribtypeinfo() [www.sidefx.com].
Edited by Tanto - June 6, 2023 14:22:18
User Avatar
Member
1179 posts
Joined: April 2017
Offline
My method (might not be the best), is to activate the "Output Attribute" in your tranform sop. It will output a matrix named "xform". In a prim wrangle below, put this code:

matrix xform = detail(0, "xform", 0);
v@other_vector *= xform;

Attachments:
Houdini_primVectorTransform_01.JPG (62.7 KB)

User Avatar
Member
134 posts
Joined: Sept. 2021
Offline
Tanto
A simple way to do it is to first create your attribute using an attribute create sop. You can specify that your attribute is indeed a vector (transformed) and not a float of size 3 (not transformed).

If you want more control, look up setattribtypeinfo() [www.sidefx.com].


Wow, that worked! So, there's a difference between using a wrangle and setting an attribute with v@ and creating a vector attribute with the attribcreate sop. Why is that? Does using v@ just create a float of size 3, like you hint at?
User Avatar
Member
542 posts
Joined: Nov. 2016
Offline
Look at the attribute info link for more info, Houdini attaches metadata to attributes to specify which transforms will affect them. The default, which is used when creating a new attribute in a wrangle, is "none", no transforms.
  • Quick Links