Rendering a 2D float array.

Hi everyone. Is there an example I can learn from that shows how to render an RGB float array in VTK.js. The closest I could find in 2D rendering is this:, but that example uses vtkRTAnalyticSource, and I would like to use a float array.

Any help would be greatly appreciated.

You just need to create a vtkDataArray with 3 components (RGB) using a uint8 format rather than float. Then you attach it to either your points or cells depending on what they should map to.

Then you need to let the mapper know to use that array without any lookup scalar to color (MapScalars) transformation. (I don’t remember the details on top of my head) But google should give you that information for VTK/C++. Which share the same API. Or you can look into the free VTK book (pdf).