- Home /
Question by
nrvllrgrs · Jan 06, 2013 at 02:54 PM ·
screenshotreadpixels
Texture2D.ReadPixels and not lose image quality
How do I use Texture2D and not lose image quality?
When the game starts, there are a random number of splats enabled.
Then when the user presses SPACE, the game captures the screen using Texture2D.ReadPixels and pushes that texture to a background texture. After which a random number of splats are enabled.
However, the captured image loses its quality. So instead of continuously adding splats on top of splats, old splats will eventually fade away entirely.
I am using the following code:
_mainTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
yield return new WaitForEndOfFrame();
_mainTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false);
_mainTexture.Apply();
renderer.material.mainTexture = _mainTexture;
first.png
(161.5 kB)
second.png
(203.6 kB)
Comment
Answer by sdb7 · Apr 10, 2013 at 09:41 AM
Apply Mid maps..might help..
I'm not familiar with $$anonymous$$id maps. ...Do you mean mipmaps? If so, tried setting the 3rd parameter to be true, so the mipmaps were recalculated. But there was no change.