Hi, I’m trying (unsuccessfully so far) to take a camera image and get a RenderTexture from it. Once I have the RenderTexture, I need to use Texture2D.ReadPixels to read the RenderTexture, so that it can be saved out as a PNG file.
I have this code to get the initial RT from the camera…
`
RenderTexture c1render = new RenderTexture(80, 80, 24);
c1.targetTexture = c1render;
c1.Render();
c1.targetTexture = null;
`
and the following to save a Texture2D…
File.WriteAllBytes("mypath/somefile.png", texture2d.EncodeToPNG());
The bit I’m having trouble with is getting a Texture2D from the RenderTexture of my camera.
Any help would be gratefully received