Changing R8 texture values with R8 custom render texture

Hi,

I create GPU only runtime textures with TextureFormat.R8. I then “paint” these textures with CustomRenderTextures created(in runtime) with RenderTextureFormat.R8(This “painting” is done with a shader)

I keep a float value in script for the expected value of the texture, lets call it X

I paint the texture such that X goes up to 1f and the texture becomes fully red(r=255)

However, lightly erasing(-.1f) the textures over time until X becomes 0 leaves artifacts(r!=0); when I lighly erase 10 times, the texture still has some value (X=0 but r!=0).

When I use R16 textures and customRenderTextures erasing works fine. But I cant afford to use double the memory because a lot of textures will be created

Any idea what might cause this? Let me know if you need any extra info

Thanks

Ok, I think I found the issue

I should have kept a byte value instead, given R8 uses 8 bits and float’s have 32bits.

This must have been a coincidence or the precision error was too little to be felt in a byte range