'How to get the picture of what the camera covers
Question: how to get the limits of the camera when it is with the pixel perfect effect since having this applied changes the size of what it captures. unity-c#
Solution 1:[1]
Is that what you need? At least it solves "get the picture of what camera covers"
RenderTexture rt = new RenderTexture( size, size, 16 );
Camera.main.targetTexture = rt;
RenderTexture.active = rt ;
Texture2D virtualPhoto = new Texture2D( size, size, TextureFormat.ARGB32, false );
virtualPhoto.ReadPixels( new Rect( 0, 0, size, size ), 0, 0 );
byte[] itemBGBytes = newTexture.EncodeToPNG();
File.WriteAllBytes( Application.dataPath + "/Image.png", itemBGBytes );
AssetDatabase.Refresh();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pawe? ??gowski |
