Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tkeskita opened this issue Oct 4, 2020 · 6 comments

Comments

@tkeskita
Copy link
Owner

tkeskita commented Oct 4, 2020

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 added a commit that referenced this issue Oct 10, 2020
- VTK To OpenVBD Exporter allows conversion of 3D VTK image data
  to OpenVDB file format, so that data can be imported into
  Blender as Volume Object, for use in volumetric rendering.
  This is essentially a workaround needed until Blender Python
  includes pyopenvdb, so that VTK To Blender Volume node can be
  used with out-of-box Blender.
- The new node exports density, color, flame and temperature fields
  into a JSON text file, which can be processed outside of Blender
  with an external Python installation (pyopenvdb is required)
  using script utils/convert_to_vdb.py.
@tkeskita
Copy link
Owner Author

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

@tcdoe
Copy link

tcdoe commented Apr 5, 2021

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.

@tkeskita
Copy link
Owner Author

tkeskita commented Apr 6, 2021

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..

@CFDTom
Copy link

CFDTom commented May 29, 2023

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.

@tkeskita
Copy link
Owner Author

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

@CFDTom
Copy link

CFDTom commented May 30, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants