GrayscaleEffect.cs 459 B

123456789101112131415
  1. using UnityEngine;
  2. [ExecuteInEditMode]
  3. [AddComponentMenu("Image Effects/Grayscale")]
  4. public class GrayscaleEffect : ImageEffectBase {
  5. public Texture textureRamp;
  6. public float rampOffset;
  7. // Called by camera to apply image effect
  8. void OnRenderImage (RenderTexture source, RenderTexture destination) {
  9. material.SetTexture("_RampTex", textureRamp);
  10. material.SetFloat("_RampOffset", rampOffset);
  11. Graphics.Blit (source, destination, material);
  12. }
  13. }