I am currently working on a solution to make my game look very pixelated, like Doom or Quake. But there is a big problem.
B.T.W I'm not using Unity Pro
I render my camera to a 1920x1080 texture, then I try to use Texture2D.Resize on it, then render it back to the screen using ScaleMode.StretchToFill.
But the problem is that the texture seems to corrupt when I use Texture2D.Resize on it.
Here is a video of what's happening (The texture is rendering ontop of the scene): http://www.mavain.com
And here is my current code: using UnityEngine; using System.Collections;
public class PixelRenderer : MonoBehaviour {
Texture2D texture;
// Use this for initialization
void Start () {
texture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
}
// Update is called once per frame
void OnPostRender() {
texture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
texture.Apply();
texture.Resize(256, 256);
}
void OnGUI() {
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture, ScaleMode.StretchToFill);
}
}
(Sorry for the crappy indention, that isn't my fault.)
Is there something that I'm missing here? Or am I doing something wrong?
Please help!