Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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!

share|improve this question
    
For a pixelated look try rendering it to a smaller texture first then copying it back to the screen and skip the resize step altogether. –  Jeremiah Leslie Jun 11 at 12:43

1 Answer 1

Texture2D.Resize does not resize texture, it changes amount of memory allocated by texture, like trimming an array.

Check Texture Adjustments asset, it offers high performance GPU accelerated texture scale/resizing.

https://www.assetstore.unity3d.com/en/#!/content/37732 enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.