Limit rendertexture colour range

I’m using Simple Pixelator (code to follow) to pixelate a scene to give it a proper pixel density relative to the rest of my game and I’ve run into a problem.

In spite of this texture being solid black and white, it interprets certain angles as being grey. I would like my textures to maintain their exact colour depth. Is there a way this can be accomplished? Right now, this is the code I’m using:

//SimplePixelizer
//Copyright © The Breemans Lounge Company
//This script should be available for free in the Asset Store. if you found this script, or bought this script, from a third party seller please contact us
//contact@breemanslounge.com

using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Pixelizer")]
public class SimplePixelizer : MonoBehaviour {	
	public int pixelize = 1;
	protected void Start() {
		if (!SystemInfo.supportsImageEffects) {
			enabled = false;
			return;
		}
	}
	void OnRenderImage (RenderTexture source, RenderTexture destination) {		
		RenderTexture buffer = RenderTexture.GetTemporary(source.width/pixelize, source.height/pixelize, 0);
		buffer.filterMode = FilterMode.Point;
		Graphics.Blit(source, buffer);	
		Graphics.Blit(buffer, destination);
		RenderTexture.ReleaseTemporary(buffer);
	}
}

Bump. This is still causing me grief and Unity Answers hasn’t been any help.

Sorry, I don’t have an answer for you, but another question:

Is simple pixelizer only for UnityPro? I did not see any such disclaimer, but does not seem to work for me.

Thanks.

This code would only work with pro.

Hi!
It probably has to do with mipmapping, and you should try messing with the mipmapping settings for the rendertextures.

RenderTexture doesn’t have mipmaps enabled by default and none are generated in the code SimplePixelizer uses. Unfortunately, my Pro trial has long expired so this is moot until I decide to take the plunge and buy it.

I think the problem is you don’t have point sampling enabled for the first blit going from ‘source’ to ‘buffer’. So you need to add:

source.filterMode = FilterMode.Point;

If you end up getting Unity Pro hopefully that will fix it.