hi all!
I have my camera that contains some effects like Antialiasing, DoF, Bloom, etc…
I wish make a shot using render to texture, 'cause I wish the shot bigger than the real camera size…
I used this code:
RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);
Camera.main.targetTexture = rt;
Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.ARGB32, false);
Camera.main.Render();
RenderTexture.active = rt;
screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
Camera.main.targetTexture = null;
RenderTexture.active = null;
Destroy(rt);
byte[] bytes = screenShot.EncodeToPNG();
string filename = @"c:\temp.png";
System.IO.File.WriteAllBytes(filename, bytes);
Debug.Log(string.Format("Took screenshot to: {0}", filename));
and it works, but all the effects that I’ve added are not present, and also the UI…
how can I do? thanks