Getting OpenVDB grids in render engine 2.83

With 2.83 there is now a “VOLUME” object type which can have an bpy.types.Volume data, which is a holder for OpenVDB data.

Is there a way to get the openvdb grid data via the python interface or is it expected a render engine would take the vdb filename from this and get the data itself using the openvdb api. I took a quick look but nothing obvious in python interface. Mainly a question for @brecht but relevant to other render engines I assume.

2 Likes

At the moment the only way is to read the file directly. I should add a property that tells you the file path for the current frame.

In future releases we will support volume modifiers, in which case the volume may only exist in memory. In that case we’ll need Python API access for the OpenVDB grid too. We plan to add pyopenvdb but that probably isn’t for 2.83.

We could add some way to access the OpenVDB grid pointer through the Python API, is that something you would use? Of course your OpenVDB library would have to be the same version as Blender’s (7.0.0 following the VFX reference platform).

I’m not really sure what that would get us any better than the file name and grid channel which is there already… so no, don’t think that’s worth it. Other than not loading the data into blender’s memory and the renderer’s memory…

It never hurts to have pointer access, in my opinion.

2 Likes

Strongly agree … having a pointer to the data is by far the best option.
Although giving access through the Python API is still a good option, for addons that don’t use pointers, of course.
Greetings…

1 Like

I’ve added volume.grids.frame_filepath now which gives the filepath for the current frame, which avoids having to construct that manually and reimplement the logic for start/offset/repeat/etc.

I plan to add pointer access, but probably not in 2.83 since there isn’t really any convenient way to do it. Rather this would be available when we add pyopenvdb for Python access to the OpenVDB grids.

3 Likes

Can I already now somehow enable building of pyopenvdb as part of compiling Blender, so I could import pyopenvdb in a Blender Python script?

No, there is no code for this yet.

You could build OpenVDB and its Python module separately and import that, but it wouldn’t allow you to edit Blender OpenVDB volumes.

1 Like

I are updated my exporter to integrate in the new ‘Volume’ interface…
Thank you Brecht

Hello All,
Thanks for all the info from people in this thread. I’ve been trying to get this to work as well, as importing volume data from a vti file (volumetric image data, stress, strain, etc.) is extremely important for me.

  • I see there isn’t much activity lately? :thinking:

Is there any progress, especially on the pyopenvdb incorporation, or getting this working in 2.9x ?

(edit) Also, I’m kind of new to this, can anyone point me to a simple explanation of where/how I can get the custom build working in Windows? I’ve built blender in the past in visual studio no prob, but it’s been awhile. Maybe there is a pre-built binary for win 64? Thanks!

Any info greatly appreciated.

What is going on?I also need blender build with integrated pyopenvdb.How to do build it in win10 or linux?

Below are the steps I took to build pyopenvdb in a Windows 10 environment.
https://sigull.github.io/techinfo/

Just bumping this thread since it’s been a year—has there been any progress towards making volume grid pointer access available? Is pyopenvdb being shipped with Blender yet? I’ve got an addon I want to write that involves directly updating the voxel grid of a volume on a frame-by-frame basis and am curious if there’s any chance of this being made possible soon.

There is work being done to ship pyopenvdb with Blender 3.4 or 3.5, but there’s no specific timeline for integrating it with Blender volumes.

1 Like