Jump to content
Efi

Set voxel value with Python in a hou.VDB

Recommended Posts

Hello,

I need a way to set the value of a voxel of a hou.VDB with python.

Do you know if there is  an equivalent to the setVoxel() function used to the hou.Volume for the vdb ?

Thanks in advance,

Share this post


Link to post
Share on other sites

why not use VEX? Python is extremely slow and single threaded.

Share this post


Link to post
Share on other sites

I need to specify the volume's name with a variable because I use a multiparm block to collect the volume name.

image.png.1494a10e6a798dd1bddac04908abdd75.png

I didn't find a way to specify the name by variable with vex so I try first to generate vex with python, something like this 

content = "@" + volume_name + " = " + volume_value + ";"
return content

But the problem with this solution is that the wrangle is in a for loop (for the multiparm block) and so on it crash sometime because of the update of the vex code. So I did it on python, but I'm stuck with vdb volume.

I would have liked to do it in vex but for that I would need a function like point 

setpointattrib(0, name, @ptnum, value, "set");

It's for the tool of this video (time : 01:34)

 

Share this post


Link to post
Share on other sites

in a volumeWrangle, if you turn off Autobind by Name
you can separate the volume Name in SOPs from the volume name in VEX.
here, density can be referenced to any string attribute

bindname.png.51cf5c3d5405abc2655fd9e37192f6d1.png

bindName.hiplc

Share this post


Link to post
Share on other sites

Great. Thanks a lot I will try this way.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×