Anyone familiar with #Blender #development know whether its possible to access a volume’s #OpenVDB data in an export plugin written in #python? For instance, if I simply wanted to write out the bounding box of the vdb file? Even better: convert the OpenVDB file to #NanoVDB and write it out? Poking around python docs hasn’t yet been fruitful.
=> More informations about this toot | More toots from wjarosz@mathstodon.xyz
@wjarosz
bpy.context.object.bound_box() method gives the bounding box of the current selected object.
https://docs.blender.org/api/current/bpy.types.Object.html#bpy.types.Object.bound_box
P. D: I suspect it is for meshes. Doing a search on the docs for OpenVDB did not show to much info available.
=> More informations about this toot | More toots from DBG3D@masto.es
@DBG3D Thanks. Yes, I found this shortly after posting. It does seem to give me values corresponding to the dimensions of the volume in blender, so that’s a good start. Though ideally I’d like access to the actual VDB data, so I can use pyopenvdb functionality to inspect it and possibly convert it.
=> More informations about this toot | More toots from wjarosz@mathstodon.xyz
@wjarosz
The OpenVDB that you want to convert is generated inside blender?
Or it is imported from a external OVDB file?
If its the first case as far as I can remember, there is no access to OpenVDB data with blender API. 🧐
In the second case you could use Blender Scripting workspace and try pyopenvdb to open and convert the external file.
You need to install pyopenvdb as a module in Blender first, I do not think is included.
=> More informations about this toot | More toots from DBG3D@masto.es
@DBG3D Thanks. Yes, it’s an imported OVDB file. I’ll play around in the scripting workspace. Does blender’s python API provide access to the externally referenced files? (I do see that volume.data.filepath = //bunny_cloud.vdb, but am not sure how to get at that data from the python script yet)
=> More informations about this toot | More toots from wjarosz@mathstodon.xyz
@wjarosz
If you have the OVDB "outside" Blender you must treat as an external file. Like you will do from vanilla Python.
As I said I think blender doesnt allow you to read or write of an imported ovdb file. 🙄
=> More informations about this toot | More toots from DBG3D@masto.es
@wjarosz Take a look at this code from the ProRender exporter for blender. https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderBlenderAddon/blob/325eb7f9aa5328a02e097266e0c86b36fa6937ea/src/rprblender/export/volume.py#L104
=> More informations about this toot | More toots from bsavery@mastodon.gamedev.place
@bsavery This is very close to what I want. Thanks for the pointer!
=> More informations about this toot | More toots from wjarosz@mathstodon.xyz This content has been proxied by September (ba2dc).Proxy Information
text/gemini