Here’s a way to do it:
https://playground.babylonjs.com/#EQ46H3#10
It is normalizing the data (I have taken the first file you provided and put the data in the activities
array) and sets them as a new activity
attribute.
I’m also creating a texture for the colormap (I have taken the plasma
scale in the page you linked).
Then I’m using some custom shader code to lookup in the texture the color to use for the vertex.
There’s an easier way which would be to set the color
attribute with the right values in the js code. Basically, in the js code you would read the colormap texture for each activity value and create an array with those colors, that you would set like rightVertexData.colors = rightColors
. With my solution, however, you can easily change the colormap by simply binding another texture to the colormap
uniform.