Jump to content

export VDB data to a 3D matrix into a txt file


Alexandre

Recommended Posts

I found some startup ideas here : https://www.sidefx.com/forum/topic/56423/?page=1#post-255419

I use a py node for data export, with vdb visualize tree because the py node from the link export data geometry spread sheet

now I need to find how to reshape the vdb_float attribute (in relation to ptnum) from geometry spreadsheet in order to get a 3D matrix (basically, a matrix of 0 and 1 for a binary object)

Capture2.JPG

Capture.JPG

Edited by Alexandre
Link to comment
Share on other sites

Can someone help me on that ?

I am diving in python world and found some help using houdini doc : http://www.sidefx.com/docs/houdini/hom/hou/VDB.html

I have basically written the function found at the link above, and I try to use this function on my vdb volume (filled inside) but it seems that the object has no attribute 'activeVoxelBoundingBox' :/

I'm 100% sure the problem comes from me, so if someone can put me on the right track I would be grateful

thanks

 

 

Capture2.JPG

Capture.JPG

Edited by Alexandre
Link to comment
Share on other sites

here is the example

connect the Python SOP directly to the geo whose first primitive is the VDB volume you care about

import numpy

node = hou.pwd()
geo = node.geometry()

vdb = geo.iterPrims()[0]

vdbRes = vdb.resolution()
vdbBounds = vdb.activeVoxelBoundingBox()

values = vdb.voxelRange(vdbBounds)
values = numpy.array(values)
values3d = values.reshape(vdbRes, order='F')

print values3d

 

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