Hi All,
I want to write float number into a Rfloat texture, but I can’t succeed using setPixel or setPixel32.
Here is a basic sample (no real usage just for sample).
void setFloatToTexture()
{
Texture2D tex = new Texture2D (128,128,TextureFormat.RFloat,false);
Color32[] pixels = new Color32[128*128];
for (int i = 0; i < 128*128; i++)
{
float value = 234.23f*i;
pixels[i] = new Color32(value, 0.0f ,0.0f,1.0f);
}
tex.SetPixels32(pixels, 0);
tex.Apply();
}
The problem is that Color32 accept only bytes, so i get an error.
Does someone know how to do it? a small code sample would be appreciated.
Thanks!