tkeskita / BVtkNodes

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

Make ColorMapper node work with vectors #90

Closed joeadamay closed 1 year ago

joeadamay commented 1 year ago

The ColorMapper node workflow currently only supports scalar data for coloring. This PR changes ColorMapper and VTKToBlenderMesh to automatically calculate and use the magnitude of the incoming vectors, while leaving scalar data unaffected, which hopefully resolves issue #58 (Color Mapper node color by vector field magnitude).

Below is a comparison between the old color mapper and the proposed one using the cubeflow_stream_tracers example.

The old color mapper using a raw vector array U doesn't use the magnitude of the vectors: bvtk-master-U

The old color mapper using an ArrayCalculator to calculate mag(U): bvtk-master-mag_U

The proposed color mapper with the raw vector array U is identical to the output with ArrayCalculator: bvtk-fix-issue-58-U

As a side note, I'm fairly new to BVtk and vtk, so please tell me if the way I implemented this is improper or could be handled more elegantly.

tkeskita commented 1 year ago

This is good, thanks for pull request!