EdgeDetectEffect.cs 471 B

1234567891011121314151617
  1. // Implements Edge Detection using a Roberts cross filter.
  2. using UnityEngine;
  3. [ExecuteInEditMode]
  4. [AddComponentMenu("Image Effects/Edge Detection (Color)")]
  5. public class EdgeDetectEffect : ImageEffectBase
  6. {
  7. public float threshold = 0.2F;
  8. // Called by camera to apply image effect
  9. void OnRenderImage (RenderTexture source, RenderTexture destination)
  10. {
  11. material.SetFloat ("_Treshold", threshold * threshold);
  12. Graphics.Blit (source, destination, material);
  13. }
  14. }