Open cheind opened 1 year ago
we currently support rasterizing the volume and exporting the data as npz file. This can be loaded in vispy for rendering, but support is limited. See https://github.com/cheind/torch-instant-ngp/blob/5c6b035601cfd2bf2506856e4552147ec5bd4feb/scripts/vispy_render.py for a working example.
for blender it seems like we need to have openvdb support, but the python-interface seems to be quite nasty to use. Maybe consider a simple pybind11 wrapper for the API we need?
Geometry nodes in Blender 3.3 have now the "Volume Cube" thanks to the author of b3dsdf that have a nice collection of useful nodes. It would be very useful to have this implemented inside blender as an addon!
@diramazioni thanks for mentioning! I'm not familiar with geometry nodes: how would you link up the nodes so that it reads a discretized field composed of density/color values (from some source: file, python code)?
I'm no expert either but looks like the volume cube accepts only density values (no much info about it). In any case I've researched for a way to get the data in and I found this addon that reads csv/json and import it in geometry nodes's spreadsheet.
Upon researching it a bit further, writing openVDB seems the way to go and import into Volumetric Grids inside GeometryNodes. Blender and volume object using openvdb python example
I've come accross vdp, but its python interface is quite broken as far as installation on windows etc. is concerned.
It seems indeed complicated, and not officially supported on win. I found this bug report with instructions for win10. Also I can't seems to find pyopenvdb on pip (on linux). I've yet to attempt to build it my self for linux following the official guide. Anyway openVDB seems to be the only way to do it in Blender
Researching on this issue I've also found:
YT (an open-source, permissively-licensed python package for analyzing and visualizing volumetric data)
NanoVDB Nvidia's GPU accelerated VDB supposedly already integrated in blender. However there is little info about it. One advantage is that is implemented in few header files, and has virtually no dependencies on external libraries NanoVDB info
Thanks for your research. I've come across NanoVDB previously, but haven't been able to find out whether it delivers a custom vdb writer. As an alternative I've considered to write a minimal openvdb file writer similar to what I've done for EXR
potententially use a https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/volume_principled.html shader