TextureType grayscale
I want to store a 2 array of floats, just like a heightmap in a texture, what is the texture type im looking for? And how to properly set the texture pixels value?
Texture2D texture = new Texture2D(3, 3, TextureFormat.RFloat, false);
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
texture.SetPixel(i, j, new Color(value 0, 0));
}
}
Is RFloat the format i want for that?
Does value have to be between 0 and 1, and then i multiply it by the max value as i retrieve the pixel information from the texture?
Or is value supposed to be from 0 to 255?
Should i set values to the other colors as well? Like New Color(value, value, value) ?
Can i store int instead of float?
Is reading values from texture about as fast as reading values from an array?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612043044im_/https://answers.unity.com/themes/thub/images/avi.jpg)