Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TinyPixelPerfect : MonoBehaviour
- {
- private Material postprocessMaterial;
- public int Width = 32;
- public int Height = 32;
- private void Start()
- {
- postprocessMaterial = new Material(Shader.Find("Custom/TinyPixelPerfect"));
- }
- //method which is automatically called by unity after the camera is done rendering
- void OnRenderImage(RenderTexture source, RenderTexture destination)
- {
- postprocessMaterial.SetFloat("x", (float)this.Width);
- postprocessMaterial.SetFloat("y", (float)this.Height);
- //draws the pixels from the source texture to the destination texture
- Graphics.Blit(source, destination, postprocessMaterial);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement