- Home /
Is it possible to take screenshots bigger than screen size?
Hi,
Is it possible to take screenshots bigger than screen size ?
Edited:
I wrote this script but when I change my size to something bigger than screen size it don't work. It seems unity wants to capture from screen itself not the renderTexture.
import System.IO;
var width : int = 2048; var height : int = 2048;
function Start() {
var rt : RenderTexture = new RenderTexture(width,height,0);
rt.width = width;
rt.height = height;
rt.format = RenderTextureFormat.ARGB32 ;
camera.targetTexture = rt;
camera.Render();
print (rt.width);
print (rt.height);
var tex = new Texture2D (width, height, TextureFormat.ARGB32, false);
tex.ReadPixels (Rect(0, 0, width, height), 0, 0);
tex.Apply ();
var bytes = tex.EncodeToPNG();
Destroy (tex);
File.WriteAllBytes(Application.dataPath + "/../SavedScreen.png", bytes);
camera.targetTexture = null;
}
After you rendered your scene into your render texture via the camera, assign the render texture into the 'active' render texture, like so:
RenderTexture oldRT = RenderTexture.active;
RenderTexture.active = RT;
//... //Create texture, ReadPixels, write to file... //... RenderTexture.active = oldRT;
Answer by taoa · Feb 24, 2011 at 02:20 PM
Yes, and that's how I did it: http://answers.unity3d.com/questions/36875/how-to-save-a-render-texture-to-a-file
" I create a high-res render texture (x times the actual game window size) that I attach to a camera, and perform a camera.Render(), which draws the content of the scene into the render texture. "
I got help in how to save a render texture to a file (hence my question):
" You can use ReadPixels with a rendertexture "
That's all you need!
Thanks for your help. I tried that but I have a problem with writing it in file. I edited my post with my script. Any help would be appreciated.
Your answer
Follow this Question
Related Questions
How to get a screenshot in game and re-use in game? 1 Answer
Screenshot is not save properly into the folder. 0 Answers
Does Application.CaptureScreenshot leak memory? (iOS) 0 Answers
Screen capture with System.Drawing not working 1 Answer
I need to take (save) a screenshot from a camera other than the main one. How would I do this? 0 Answers