Quantcast
Channel: Answers by "pixel_fiend"
Viewing all articles
Browse latest Browse all 18

Answer by pixel_fiend

$
0
0
I had this bug because I was trying to read pixels into a `TextureFormat.ARGB32` from a `RenderTexture.RGBAFloat`. I fixed by specifying the TextureFormat in Texture2D constructor to match when creating the reading texture. outputTexture = new RenderTexture (128, 128, 0, RenderTextureFormat.ARGBFloat); RenderTexture.active = outputTexture; tmpTexture = new Texture2D (outputTexture.width, outputTexture.height, TextureFormat.RGBAFloat, false); // NOTE: MUST MATCH FORMAT OF ACTIVE RENDERTEXTURE! tmpTexture.ReadPixels (new Rect (0, 0, outputTexture.width, outputTexture.height), 0, 0, false); tmpTexture.Apply (); RenderTexture.active = null;

Viewing all articles
Browse latest Browse all 18

Trending Articles