BVtkNodes icon indicating copy to clipboard operation
BVtkNodes copied to clipboard

Unstructured VTK data

Open mhdhassan opened this issue 4 years ago • 15 comments

Dear BVTKNodes, I am new to this feature , I have a particles confined between two planes ( normal to z axis) the particles and the planes are in vtu format and named (particle_0.vtu and particle_1.vtu) and the same for the planes (wall_0.vtu…etc) where each *_n.vtu is for time step. particles have the following attributes :- radius, a velocity vector and species. I managed to create the tree as shown in the attached image . I am still struggle how to color the particle using the velocity ? how to scale particles to their real diameter size (eg. particles with different radius )? secondly, I would like to show the walls as well how can I do that (Knowing that the wall is moving)? thirdly, how can i create a video animation could you share a setup or a tutorial ? Kind Regards,

screnshot particles para data_sample.zip

tutorial? Looking really to your respond and recommendations.

mhdhassan avatar Aug 22 '20 19:08 mhdhassan

Hello @mhdhassan ,

This node image is too small to see node names and their settings, can you please provide larger snapshot of only nodes? For tutorial please see Node Examples for Unstructured Grids. Walls can be read in with another reader node and follow-up nodes in the same node tree to export walls as separate object. If you use Time Selector Node after a reader node you should be able to simply use Render Animation in Blender to render all frames.

tkeskita avatar Aug 23 '20 09:08 tkeskita

Dear @tkeskita attached a a screenshot for the node tree, I have noticed time selector node not working . also for the wall do I need to add vtkplaneSource ans set the dimension of the vtkplaneSource equal to the walls ? number of particles in the system is around 1501.

Kind regards. screnshot

mhdhassan avatar Aug 23 '20 15:08 mhdhassan

Hi, thanks for the node setup image. Here below is my nodesetup, which seems to work also for animation rendering. When you change frame on Blender Timeline editor, it should correct the number in reader file name. Note: numbering in file name should be padded with zeros to always get correct result.

In your case it was necessary to use vtkAssignAttributes to get glyph orientation correct. You can also use vtkSphereSource as the glyph if you want, in that case orientation does not matter. Maybe enable "Smooth" in VTK To Blender node. Scale Factor for Glyph3D is a small non-zero number.

Note: There was a bug in VTK To Blender node face creation, which caused walls not to show up, so you need to install very latest version of the add-on to show the wall surfaces. Also remember to switch to rendered viewport shading to see colors. HTH!

Screenshot_2020-08-24_11-36-57

tkeskita avatar Aug 24 '20 09:08 tkeskita

Dear @tkeskita, I managed to create all the nodes except vtkAssignAtrribute node, could you share python script for it and the steps on how to do it or ( a tutorial for it )?

Kind regards,

mhdhassan avatar Aug 26 '20 12:08 mhdhassan

Hi,

you don't need python to add Custom Code to a node. See Edit and Save Custom Code in the documentation. Those operators are located in Properties tab. Click on the vtkAssignAttribute node, then run Edit Custom Code, add the code in Text Editor (BVTK text block), then run Save Custom Code. Code should appear in the node when mouse cursor is moved to node editor.

tkeskita avatar Aug 27 '20 15:08 tkeskita

Hi, thanks for the node setup image. Here below is my nodesetup, which seems to work also for animation rendering. When you change frame on Blender Timeline editor, it should correct the number in reader file name. Note: numbering in file name should be padded with zeros to always get correct result.

In your case it was necessary to use vtkAssignAttributes to get glyph orientation correct. You can also use vtkSphereSource as the glyph if you want, in that case orientation does not matter. Maybe enable "Smooth" in VTK To Blender node. Scale Factor for Glyph3D is a small non-zero number.

Note: There was a bug in VTK To Blender node face creation, which caused walls not to show up, so you need to install very latest version of the add-on to show the wall surfaces. Also remember to switch to rendered viewport shading to see colors. HTH!

Screenshot_2020-08-24_11-36-57

Dear @tkeskita, In the above quote you have mentioned that the vtk for walls will not be seen and in order to see it I have to update BVTKNodes to the latest version. I believe this is the link for most recent version blender https://github.com/tkeskita/BVtkNodes Blender version is 2.83 and the vtk version is 9.0.1 Regards;

mhdhassan avatar Sep 04 '20 14:09 mhdhassan

That's correct otherwise but supported vtk version is 8.1.2.

tkeskita avatar Sep 05 '20 15:09 tkeskita

Dear @tkeskita, I have test it also with vtk version 8.1.2 and still the same issue as above (walls appears as dots) knowing that the walls are not triangulated ( meaning there is only four edges in the wall). this is a photo for the wall using paraview highlighted the edges . Regards, ss

mhdhassan avatar Sep 07 '20 09:09 mhdhassan

Maybe your add-on is not up to date. Can you please try Blender Preferences -> Add-ons -> BVTKnodes -> Remove. Close Blender. Open Blender and make sure BVTKNodes is not listed in add-ons. Then download again latest version from github (Code -> Download) and install it again in Blender.

tkeskita avatar Sep 07 '20 14:09 tkeskita

Dear @tkeskita, I did update BVTKNodes and it works fine, I was able to do the rendering for particles with the same diameter, I have another case where particles diameter is different, and I was not able to represent their actual size. any suggestion on how to scale them in order to represent all the particles with their actual size ? Regards, Hassan

mhdhassan avatar Nov 02 '20 10:11 mhdhassan

Hi, in vtkGlyph3D there is option ScaleMode, if you change it to ScaleByVector it should work. Is your diameter scalar or vector? Scalars can be converted to vectors by array calculator, maybe with Function like diameter*kHat (not sure about this)?

tkeskita avatar Nov 02 '20 15:11 tkeskita

Hi, thanks, it's a scalar. I will go through it soon. Hassan

mhdhassan avatar Nov 02 '20 16:11 mhdhassan

dear @tkeskita ; I have tried to do the scaling Particle_0.vtu.zip

for the particles with different diameters in blender, with no success. I have attached the node tree screenshot as well as one vtk file for the particles, hoping to have more insights from you. (you will see that I have tried arraycalculator but I got an error message, so I detach it from the rest and that what i got in the pictures below) Kind Regards, Hassan particls s1

mhdhassan avatar Jan 28 '21 09:01 mhdhassan

Hi, I was able to scale vectors using this setup where there is two vtkAssignAttribute nodes, one to set active scalar (used for scaling) and another to set active vectors (used for glyph orientation):

Screenshot_2021-02-02_20-59-38

tkeskita avatar Feb 02 '21 19:02 tkeskita

Hi @tkeskita , thank you,:) I was able to generate the actual particle size as in the figure below. Kind Regards, Hassan Screenshot

mhdhassan avatar Feb 02 '21 19:02 mhdhassan