Effect.cs 520 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace ShaderControl {
  4. [ExecuteInEditMode]
  5. public class Effect : MonoBehaviour {
  6. Material mat;
  7. string[] keywords = new string[] {
  8. "ENABLE_RED_CHANNEL",
  9. "ENABLE_GREEN_CHANNEL",
  10. "ENABLE_BLUE_CHANNEL"
  11. };
  12. void Start () {
  13. mat = Resources.Load<Material> ("ChromaScreen") as Material;
  14. }
  15. void OnRenderImage (RenderTexture source, RenderTexture destination) {
  16. mat.shaderKeywords = keywords;
  17. Graphics.Blit (source, destination, mat);
  18. }
  19. }
  20. }