Jump to content

How to read/write attributes in Volume Wrangle?


Recommended Posts

Hi,

Is there a way to read/write attributes in Volume Wrangle? For example if your volume primitive had a count attribute? Or if you want to get the name of the currently processed volume and store it?

It feels a little like a black box.

Also when you don't bind every volume to density and change each volume, is it the same as using Bind Each Volume to Density in terms of performance?

I just don't know if doing this:

  1. @density = 1;
  2. @heat = 1;
  3. @temp = 1;
  4. ...

is the same as (when Bind Each Volume to Density):

  1. @density = 1;

Because if it was in Attribute Wrangle, it would be different as the first method would be run for each element.

 

Thanks :)

Link to comment
Share on other sites

VolumeWrangle is just HDA with Volume VOP inside.

To my quick test with VolumeVOP (4xfloat VDB, bind/bind export node and multiplied by AA noise), Bind Each Volume to Density is slower then Autobind by Name.

Try to think about volumes as different type of primitives. Name is just another primitive's attribute.

  • Like 1
Link to comment
Share on other sites

Thanks pezetko. If I do something like this in a Volume Wrangle, I don't see any new attribute though.

For example I have a prim attribute called count with a value of 5 for everyone:

  1. i@mycount = i@count;

I don't get a new attribute on the volumes. I just wanna see if I am able to access i@count properly which also doesn't seem to be the case.

 

Link to comment
Share on other sites

if you need to get/set primitive attributes from Volume Wrangle, use prim(), addprimattribute() and setprimattribute() functions, since binding in Volume Wrangle binds to volume data not primitive attributes

Link to comment
Share on other sites

I just want to modify volumes using prim attributes. For example divide voxel values by a value stored in a prim attribute on that volume.

But doing this for multiple volumes that each have their own prim attributes.

Link to comment
Share on other sites

not sure how you can do it in just Volume Wrangle/VOP for arbitrary number of input volumes

maybe use ForEach to loop over volume primitives, then you can always get attribute from primitive 0, bind to density and alter it, you would need to make sure all volumes are just float volumes

 

  • Like 1
Link to comment
Share on other sites

well, I said that mostly for simplicity as you can always have just float volumes even to represent vector or matrix fields

but of course you can make it to work with mix of vec3, float vdbs and houdini volumes

then in foreach just switch between Volume Wrangle/VOP bound to vector field and Volume Wrangle/VOP bound to float field based on type of the volume 

  • Like 1
Link to comment
Share on other sites

well, not really

all houdini volumes are composed of float volumes, no matter what data type they represent

and most used VDBs are either float or vec3 (personally I have never used int or bool, but they would probably both bind as int, so in the end you would end up switching max 3 types)

  • Like 2
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...