tkeskita / BVtkNodes

Create and execute VTK pipelines in Blender Node Editor
GNU General Public License v3.0
118 stars 20 forks source link

Using Bvtk nodes for volume rendering node template #24

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi,

I recently got into using Blender for post-processing my ParaView Data and saw the efforts you all made! Being said, I can currently export my data to .vtk,. vti formats. I can post process my surface data, but not my volume rendering data despite correctly having access to the Bvtk nodes addon and successfully installing it. I am using Blender 2.90, with VTK 8.1.2 (on Win10) and installed your add-on. Everything works fine, but I am confused on a few things:

1) how do I install the build version of Blender with access to pyopenvdb? I am new to this so I am not familiar with some things despite reading the docs.

2) I saw the sample node setup for "volume rendering" but for any general .vtk, vti file, what is the preferred node reader to input the data? I saw many options and was not sure how to make a simple import procedure.

3) I tried to first follow the example used in the first image (https://bvtknodes.readthedocs.io/en/latest/BVTKNodes.html#vtktoblendervolume) for import of the data as a surface mesh instead of a volume, but even though there is no error, it does not load/generate the object. Is there something else to be done aside from this?

I don't need to use pyopenvdb but it would be better in the long run; but namely please see if you can get this file to load using either of the methods. I am struggling to use the nodes despite having the same setup and following the docs. If you have time please let me know if you are able to get this into blender either way.

I apologize if these concerns sound trivial or are in the wrong place, but seeing how I got the add-on working, I may not be understanding how to use the nodes themselves and would like your help if you have a chance. Thank you for you patience and support. The file is below:

https://drive.google.com/file/d/1BHomTpoSYWMyafilJPhTUEMOz_cSYwtq/view?usp=sharing

tkeskita commented 4 years ago

Hi,

could you please prepare a small test case, 2.2 GB is a bit heavy.

  1. Currently there are no instructions. I could theoretically provide some for linux, but not for windows. Currently there hasn't been too much interest.
  2. Choice of reader depends on your data type, gonna wait for example file to see.
  3. Sounds like no data read in, you can try to add Info node to see what data is passing by.
ghost commented 4 years ago

1) I understand; I can actually use linux too but the idea is more or less use the standard bvtk nodes developed by Silvane with the simple node configuration. Maybe its best to first try the simple import than vdb.

2) The main types of data considered are legacy .vtk, .vti and maybe csv. I have attached a sample data set from ParaView using the same volume rendering settings. Mainly please see if you are able to may a sample render using the BVTK nodes. While this is sample data, my actual data (sent prior) is made from a structured multiblock cgns grid (from cfd calculations) (exported as a tecplot binary .plt file and post processed in ParaView to be exported at a .vtk/.vti file). I mention that in case it helps you determine what should be the best reader for these data types. wav.zip

3) actually using the setup from the first image did generate a "mesh" in the properties tree, but the item was not physically shown in the 3d workspace indicating that there was something wrong. I think Silvano's simple node approach would work but the main thing is seeing how to load my data. Again, sorry for the large data, that was my actual intended file, but the smaller one attached here uses the same export method. Namely I want to be able to produce a volume render which looks like this: volume render

I also saw your sample volume render approach: https://bvtknodes.readthedocs.io/en/latest/ug_nodes.html#volumetric-rendering

But I guess finding the correct reader is my first issue.

I hope this helps you understand what I mean. Thanks for the help, I appreciate it. By default the full control volume surface data looks like this: roughblendercontour

So to get that volume contour I had to: resample the data to image data to allow for volume rendering and then adjust and hide certain contour values for the "Mach Number" array/variable. Otherwise by default it appears as the full box data.

tkeskita commented 4 years ago

Ok, what you have is VTK image data. You can use vtkStructuredPointsReader for the vtk file and vtkXMLImageDataReader for the vti file. Then you can either process the image data or use vtkExtractCells with Custom Code like AddCellRange(0, 1000000) to convert to unstructured grid (will be heavy) and process that.

image

If you need volumetric rendering, please read carefully through this thread: https://github.com/tkeskita/BVtkNodes/issues/19

ghost commented 4 years ago

Ah ok thanks for the help. Let me give it a try and get back to you! I appreciate the link to the other thread. I will provide an update soon.

ghost commented 4 years ago

Ok some things: 1) using the .vtk, .vti files sent, I have noticed converting to an unstructured grid immediately fails. Also, using the .vtk file immediately fails. I was able to generate a "mesh" object in vti2reader.blend. I will attach all four variants here.

2) I believe the memory issue in loading files is bad so I tried the node setup to import a tiff file after first generating the image data in ParaView. I think there is some slight issue here but this approach seems to be what I want to work (i.e. volume render). Please see if you can generate a mesh object this way. Please see the zip with the four layout files and the new recent TIFFreader.blend below: layout for import.zip

Please let me know if you are able to create the contour from the .tiff file. Thank you. Also see the available data types through this screenshot in case there is another way: Screenshot (36)

Currently, if I can figure out the tiff reader, that should be the way as I wish to cycle through 200 different frames/tiffs in the same stacking manner and output a screenshot of the volume render at each point to make an animation. There is no need to split unless I am trying to make the resolution larger correct? I usually try to make it 3,840x2,160(4k) so hopefully there is no need for any image splitting.

ghost commented 4 years ago

In other words I am using the approach to make an iso-surface/volume render as shown in the thread you mentioned. Please see if you are able to make it work. I am able to run it but am not sure why there is object being shown.

tkeskita commented 4 years ago

Hi, please go through the tutorial examples in https://bvtknodes.readthedocs.io/en/latest/ug_nodes.html using the cubeflow example data to get familiar with data processing with unstructured grids.

If Info node shows data like in my previous example, then the reader is working correctly. In vtkExtractCells try to convert smaller amount of cells, it can run out of memory -> can't be used in large cases.

I was able to contour the tiff file like this: image I haven't used the UV method described in #19 so I can't help you there, sorry.

ghost commented 4 years ago

Ah ok this helps a lot! So I just tried your approach and I was able to make it work for the sample data I sent. For my actual data, tiff export does not seem to work due to it being a different data type. Another question: what would be the preferred reader for vtk poly data (.vtp) and would the same approach work if I change the reader? I saw you made a prior addon: io_mesh_vtk as well.

Again I will read more on this as at least tiff import works well. Maybe my data needs to be different. But I wanted to ask the above as an alternative. Thanks for your help! I look forward to hearing back from you.

ghost commented 4 years ago

I have just tried the tiff method with another data format and it worked so I guess moving forward I will try to use that method for volume rendering. I will give it a try in the coming weeks and let you know how it works. Thanks for the help!

ghost commented 4 years ago

Hi tkeskita,

I am writing to say although the method for reading the tiff image for the sample data works, it appears to not work well for the desired data (much larger data set). I guess I cannot load in image data as a volume render in this way. I also found that I can convert the original data set to a .vtm (multiblock image data set) which also makes a folder with .vts files (pertaining to the number of zones in the multiblock grid). I am not sure if you are familiar with either of those formats.

tkeskita commented 4 years ago

Hi, do you mean that the tiling + UV mapping method of #19 fails for your large data? What is your data size (voxel count)?

I know .vtm but not .vts. But if you need volumetric rendering in Blender, then I suggest to convert your data to OpenVDB, one way or another. Please see #25, I wrote a summary of current status there.

ghost commented 4 years ago

Yes, the current methodology either crashes or is not read at all into blender. I have also found of another way where someone was able to generate stacked images using custom scripts for OSL(https://sciviz.xyz/2019/05/05/volume-rendering-in-blender-with-osl/). But I cannot convert to raw data easily from my given .vtk/.vti (I wonder if I can simple use a different format instead of .raw and use a similar script). I have tried the approach in thread 19 but maybe I did not set it up correctly for my actual data set. In fact to test, I tried the same setup you had (nodes) for the sample data visualization and while it did produce something, it did not out put the full volume contour despite it working for the sample small data. I believe the sample data is attached in the zip in the comments prior (though typically these data sets are multiple GBs in total (I think in the output image data settings, I use the sample dimensions to be 800 by 800 by 800 if that is what you mean)).

Sorry I am not too familiar with the terminology (as an aside, is there a way I can learn more about these things to become more literate?). The prior data set of 2.2 GBs is still in the prior comments if you are able to look at it later on. I think the method mentioned to generate an image stack in the link should work with some modification but I wasn't sure if there were any suggestions you may want to give before I try first.

tkeskita commented 4 years ago

I've got no experience with OSL shaders, but I guess Blender's Principled Volume Shader would be more flexible to use.

Your data is structured points type, so I think OpenVDB is the right way to go. I'm gonna proceed with #25 next, but I'm unsure if there is some Python package available for Windows which includes pyopenvdb? I use Ubuntu Linux and there is python3-openvdb.

ghost commented 4 years ago

Ok I will give that a try. Currently, I am unsure of how to incorporate OpenVDB on Windows, but I will keep trying. Thanks for the help nonetheless.

tkeskita commented 4 years ago

FYI VTK To OpenVDB Exporter node is now available but you need some way to run pyopenvdb to use it.

ghost commented 4 years ago

Sure I will try to look into it more. Thanks for the heads up.