What shader is best to display an barometric chart (aka pressure value heatmap)

Hi there,
My project involves displaying an atmospheric map of air pressure in millibar, with a colored heatmap like this attached example. The pressure data is available in C# in a 2 dimension float[,] array, and I need quite a good resolution, something like float[100,100].

Anyone has suggestions how to best implement it? I have started with a Unlit Shader, passing an array of float pressure values with Material.SetFloatArray() and using the corresponding uniform float array in the shader’s code to retrieve the pressure value(x,y) and then use a scale to determine the corresponding color.
Problem: the array’s size is limited to 1,000, too low to pass a float value for each x,y point of my grid with a good resolution.

Any suggestion please? I suspect there is a better way to map a [x,y] array of values from C# to a shader to use it.

if you aren’t trying to get realtime performance, you can use Texture2D.GetPixel() and SetPixel to create a texture out of your data, and pass that to the shader through global shader parameters. i calculate radiosity using a similar method for a preprocess.

Thank you for your response. I can see how to create a texture from CPU code and set pixel color from my data. What would it do extra if I pass that to a shader?

you don’t necessarily have to pass it as a global parameter, any material property will do, as long as you edit and apply to a render texture. just do whatever you were doing to calculate the heatmap colors with the texture instead of the array.

Fragment Shader (Pixel Shader) - Best for Smooth Heatmaps

If you need a smooth, gradient-based heatmap, a fragment shader is ideal. This approach involves:

  • Sampling a pressure data texture (grayscale or floating point).
  • Using a color gradient LUT (lookup table) to map pressure values to colors.
  • Applying a smoothing function (like bilinear interpolation).

:pushpin: Pros: :heavy_check_mark: Smooth color transitions
:heavy_check_mark: Efficient on modern GPUs
:heavy_check_mark: Supports real-time updates (if pressure data changes dynamically)