If you want to add a gradient to the water tank (e.g. top is red, bottom is blue, percentage determines where red becomes blue), you have several options:
Draw the gradient with Canvas2D and apply it as a TextureCanvas to the water tank mesh. To change the hot/cold proportion, redraw the Canvas2D gradient.
Have one long gradient image (e.g. as JPEG file) and apply it as a texture to the water tank. To change the proportion of hot/cold slide the texture up or down (with texture’s offset property).
You can go without textures, by using vertex colors with fixed red/blue colors. The GPU will make the gradient. You only have to move the inner vertices depending on the hot/cold proportion.
These three approaches are illustrated below (if I were you, I’d pick the second approach):
Hi, @PavelBoytchev Thank you so much for such a well-articulated answer and not only answering the question but also teaching the ideas.
In my case I am trying to simulate the heat transfer so, for instance, it might be yellow and blue as two color values representing hot and cold water temperature in the water tank/Mesh ( hot water is top and cold water is at the bottom) and after some time the hot and cold water temperature will be different than previous instance because hot and cold water at top and bottom both will be hotter than the previous value because of solar.
So I think I need more than 2 color heat maps and I am not able to understand how can i do that.
Both @prisoner849’s option with the shader and my three options can be made to work with multiple colors. For multiple colors (and the possibility for you to pick colors and their positions in the tank), the CanvasTexture is my favorite option.
As it is too late now in my time zone, I will have a look tomorrow for a small example with canvas texture (if nobody else has answered your question by then).
But at a time, I only have two colors to be painted which might be at 0.2 and 0.3 positions in the color map. After some time not my 0.3 position color for hot becomes cold temperature and the next hot temperature is 0.4 so It needs to be painted color at 0.3 and 0.4 likewise after that 0.4 and 0.5.
But within the time when there are two certain colors in the tank, the level of color should change. I don’t know how can I achieve both things.
I am just making sure I was able to articulate the problem statement.