Advertisement
noradninja

FXAA.cs

Jul 20th, 2022
864
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3.  
  4.  
  5. [RequireComponent(typeof(Camera))]
  6. public class FXAA : MonoBehaviour
  7. {
  8.     public Material material;
  9.  
  10.     public float Sharpness = 4.0f;
  11.     public float Threshold = 0.2f;
  12.  
  13.     static readonly int sharpnessString = Shader.PropertyToID("_Sharpness");
  14.     static readonly int thresholdString = Shader.PropertyToID("_Threshold");
  15.   // [ImageEffectOpaque]
  16.     public void OnRenderImage(RenderTexture source, RenderTexture destination)
  17.     {
  18.         material.SetFloat(sharpnessString, Sharpness);
  19.         material.SetFloat(thresholdString, Threshold);
  20.  
  21.         Graphics.Blit(source, destination, material);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement