Jump to content

volumevop | indexing a component of vector field


Recommended Posts

Why directly indexing into a given component of a vector field using parm type float doesn't work ?

For example volume prim having a named attribute "test.x"  isn't accessible with the same name of type float inside volume vop.

Some insights will be helpful :)

 

Thanks,

-Gaurav

Link to comment
Share on other sites

From the help:


Autobind by Name

Will use the name primitive attribute to determine which volume binds with which parameter. If the name attribute isn’t present, the first volume is bound to density.

A name like “foo” will be bound to the float parameter “foo”. A name of “foo.x” will be bound to the x component of the vector (three float) parameter “foo”. A name like “foo.zx” will be bound to the x,z component of the matrix (three by three) parameter “foo”. 

 

Since it's a vector component it is bound as the X of that vector, despite it being a float field on its own. So simply access the vector field as "test" and then Vector To Float VOP or Get Vector Component VOP to access X.

Link to comment
Share on other sites

Hi David,

 

My question is why direct indexing doesn't work ?

AFAIK vector data type in single houdini volume primitive is n't possible yet. since vector fields are 3 separate volume primitives stacked up togather.

 

What prevents volumevop accessing each primitive directly.

 

Thanks,

-Gaurav

Link to comment
Share on other sites

I misunderstood you question, thought you are talking about accessing vector volume component directly by name with volumesample() as opposed to getting the whole vector volume using volumesamplev(), which works

 

but back to you original question

you can't name vex variable therefore parm using . (dot) , it will get converted to _ (underscore) so your variable would bind to volume named test_x if it would exist, not test.x  

 

in wrangle it's much more straightforward v@test[0]

 

but I don't think that creating vector parm/bind vop and extracting component you want is a bad thing, it makes your code work independently of whether you use merged VDB vector volumes or split ones

and it's consistent with attributes

Edited by anim
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...