Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PIXELBOY BY @WTFMIG EAT A BUTT WORLD BAHAHAHAHA POOP MY PANTS
- using UnityEngine;
- using System.Collections;
- [ExecuteInEditMode]
- [AddComponentMenu("Image Effects/PixelBoy")]
- public class PixelBoy : MonoBehaviour
- {
- public int w = 720;
- int h;
- protected void Start()
- {
- if (!SystemInfo.supportsImageEffects)
- {
- enabled = false;
- return;
- }
- }
- void Update() {
- float ratio = ((float)Camera.main.pixelHeight / (float)Camera.main.pixelWidth);
- h = Mathf.RoundToInt(w * ratio);
- }
- void OnRenderImage(RenderTexture source, RenderTexture destination)
- {
- source.filterMode = FilterMode.Point;
- RenderTexture buffer = RenderTexture.GetTemporary(w, h, -1);
- buffer.filterMode = FilterMode.Point;
- Graphics.Blit(source, buffer);
- Graphics.Blit(buffer, destination);
- RenderTexture.ReleaseTemporary(buffer);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement