Problem:
I would like to display 2 (or more) scalar fields in a single poly data mesh, using a single vtkActor. One scalar field would be mapped to certain cells of the poly data mesh, while the other would be mapped to the remaining cells. For each scalar field, I would need a seperate scalar bar.
Is this possible? I’m aware that I could use seperate polydata objects (and mappers/actors), but I would like to have a single polyData object with a single actor.
If possible, could you please explain why you want only one actor?
I could use two actors, however in theory the mesh I’m trying to represent should remain as a single entity and not be divided into seperate polyDatas.
As you can see in the figure I posted, each glyph has a checkerboad-style visualization; seperating the data into two polyData’s would allow you to display one without the other, which is not the intended usage of these glyphs. Using a single actor makes the overall pipeline easier as well (i.e. easier to use).
I am surprised that VTK can only allow you to visualise one scalar field per actor. This seems like quite a basic feature to have; or maybe am I missing a core concept that makes this 1-scalarField to 1-Actor restriction necesarry.
Note: the glyphs I posted are an open source implementation of the Tender Glyphs introduced by Zhang et al. They are used to compare two tensors in a single glyph. In order to correctly convey the differences between the two tensors, they have to display two independant scalar fields per octant of the glyph.
As far as I understand, your ideal solution may be a checkerboard/octant mode in the vtkTensorGlyph. It would ne a nice addition of this class, but require some development work.
Comparing 2 scalar fields is still complex with VTK. As far as I know there is 2D transfer functions for volume rendering, but nothing for Tensor Glyphs.
Basically the reason for this is that the mapper contains the lookup table and related methods to map data (scalar) values to color.
I don’t understand why you can’t just assign different data values to different parts of the glyph, and then map into a custom lookup table. This could easily be done with cell data, and if points between “parts” are distinct i.e. not shared, with point data as well.
Also, you can always directly create a scalar field with rgba (unsigned char) values (either as cell data or point data) and then display these. Of course you’ll have to do the mapping of data to color. I suspect if you wanted to really stretch your brain you might be able to do the same thing with a texture map approach.
In the past we’ve played around with things like streamtubes and other ways of playing around with multiple scalars. The tricky part is the API/coordinating the association between data into the geometry etc.
I think I see what you mean. Each scalar field must be represented by a different color map. So by making a custom LUT that contains n seperate color schemes, and by scaling the n scalar fields to n non-overlaping intervals, I could get the job done. While this is probably the easiest to implement, it is kind of a “hacky” method.
Note: this is basically the method I’m using in the figure I posted.
I hadn’t thought of this, it definitely gives a lot more control over what’s going on. I will consider this method as an alternative to the first. Since there aren’t any other obvious VTK-esque methods for mapping multiple scalar fields to a single mesh, I believe your answer has solved my problem.