BVtkNodes icon indicating copy to clipboard operation
BVtkNodes copied to clipboard

External Workaround for Converting 3D VTK Image Data to OpenVDB for Volumetric Rendering

Open tkeskita opened this issue 4 years ago • 3 comments

Background Since pyopenvdb is not part of Blender libs, currently it's not possible to use the new VTK To Blender Volume node without building custom Blender. It is currently unknown when pyopenvdb will be part of out-of-box Blender.

Meanwhile, there seems to be some interest in volumetric rendering of 3D image data in Blender, at least many people have opened issues about it. Currently alternatives to building custom Blender is to edit, compile and use external C++ programs (see e.g. this, or this) to convert data to openvdb, or to use tile mapping with a complex UV mapping scheme (see #19).

Proposal Provide an exporter node similar to current VTK To Blender Volume node (with color, density, flame and temperature fields), which exports VTK image data into text files. Another external Python script using externally provided pyopenvdb (e.g. python3-openvdb package in Ubuntu) could then be used outside of Blender to convert those text files into openvdb files, which could be imported back to Blender for visualization.

Please like this post if you would benefit from this kind of a workaround. Comments are also welcome!

tkeskita avatar Oct 04 '20 05:10 tkeskita

VTK To OpenVDB Exporter node is now available, but conversion to OpenVDB requires access to external pyopenvdb.

tkeskita avatar Oct 10 '20 10:10 tkeskita

I am very interested in doing this. I need to convert my VTK field FEA data results to use as openVDB in Blender...

I've tried a lot of things including building blender and trying custom blender build, but I'm having a lot of trouble and can't get it working (basically immediate crashing without error reports... etc.). I'm not that experienced at this so probably I'm doing something wrong, and I have to use visual studio and windows instead of linux for other reasons. Thx and hope there is progress.

tcdoe avatar Apr 05 '21 18:04 tcdoe

Hi @tcdoe,

I'll answer you here, but I see you've posted to many forums. I'm sorry, but since you're on Windows you don't have access to pyopenvdb (at least I do not know of any Windows package which would provide it), so you can't use VTK To OpenVDB Exporter route. I think by far easiest option for you is to use Paraview for visualization (or BVTKNodes without volumetric data).

If you insist on OpenVDB, then other (harder) alternatives is to find (or build?) pyopenvdb for Windows, or to use and customize one of the C++ programs mentioned above to convert your data to OpenVDB. Building of custom Blender with pyopenvdb enabled is theoretically possible, but the patch I think is now out-of-date, so it's no longer working and would need to be fixed. No progress there I'm afraid.

Please note: OpenVDB requires voxel data, so there is some block artefacts introduced by conversion from unstructured grids to OpenVDB voxels, as you have probably already seen in my trial in BVTKNodes gallery thread..

tkeskita avatar Apr 06 '21 15:04 tkeskita

Hi @tkeskita, I wasn't sure where to put this, but here you go, Anyway, there is a new Blender 3.5. There should by pyopenvdb integrated in this new version of Blender. Do you have any thoughts on this if this will help for vometric rendering? I know there had to be a custom build of Blender in the past to do volumetric rendering. I found a guy who succesfully imported pyopevnvdb in alpha version of 3.5. https://devtalk.blender.org/t/build-pyopenvdb-as-part-of-make-deps/14148/19 I wasn't reading to much in here, so pardon me if I'm late or didn't catch something.

CFDTom avatar May 29 '23 15:05 CFDTom

Hi,

yes it looks like Blender now finally has integrated pyopenvdb out-of-box! This assumedly makes it possible to revive the VTK To Blender Volume node, to be used for direct volumetric rendering.

Personally, I'm sticking with Blender LTS versions, so once the next LTS is released (which will hopefully also include pyopenvdb and a possibility to pip install vtk), I'll start thinking about upgrading. But, recently there has not been much activity on BVTKNodes. Maybe I'll then post an issue to collect some feedback, before starting on the upgrade work.

BR, Tuomo

tkeskita avatar May 30 '23 13:05 tkeskita

Hi, thank you for the reply. Fair enough, I'm glad I at least let you know. Thank you for the good work you're doing.

Tom

CFDTom avatar May 30 '23 19:05 CFDTom