Advertisement
tonynogo

Demo 37 - Camera script

Jul 6th, 2017
3,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. [ExecuteInEditMode]
  2. public class PostRenderer : MonoBehaviour
  3. {
  4.     public Material _material;
  5.  
  6.     void Awake()
  7.     {
  8.         _material = new Material(Shader.Find("Custom/PostRenderNoise"));
  9.         _material.SetTexture("_SecondaryTex", Resources.Load("Textures/Hatch") as Texture);
  10.     }
  11.  
  12.     public void OnRenderImage(RenderTexture source, RenderTexture destination)
  13.     {
  14.         _material.SetFloat("_OffsetX", Random.Range(0f, 1.1f));
  15.         _material.SetFloat("_OffsetY", Random.Range(0, 1.1f));
  16.         Graphics.Blit(source, destination, _material);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement