using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class Supersample : MonoBehaviour {
public Camera Camera;
public int Scale;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
private RenderTexture ss;
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (ss == null || ss.width != source.width * Scale || ss.height != source.height * Scale)
{
ss = new RenderTexture(source.width * Scale, source.height * Scale, 24, RenderTextureFormat.ARGB32);
ss.filterMode = FilterMode.Bilinear;
}
Camera.targetTexture = ss;
Camera.Render();
Camera.targetTexture = null;
Graphics.Blit(ss, destination); //, new Vector2(1.0f / Scale, 1.0f / Scale), new Vector2());
}
}