Guest User

PostProcessHighlight.cs

a guest
Mar 13th, 2020
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.Rendering.PostProcessing;
  4.  
  5. [Serializable]
  6. [PostProcess(typeof(PostProcessHighlightRenderer), PostProcessEvent.BeforeTransparent, "Harryh___h/Highlight")]
  7. public sealed class PostProcessHighlight : PostProcessEffectSettings
  8. {
  9.     public FloatParameter scale = new FloatParameter { value = 100 };
  10.     public FloatParameter shine = new FloatParameter { value = 0.4f };
  11.     public FloatParameter shadow = new FloatParameter { value = 0.1f };
  12.     public IntParameter rotations = new IntParameter { value = 30 };
  13.     public FloatParameter depthThreshold = new FloatParameter { value = 0.1f };
  14.  
  15. }
  16.  
  17. public sealed class PostProcessHighlightRenderer : PostProcessEffectRenderer<PostProcessHighlight>
  18. {
  19.     public override void Render(PostProcessRenderContext context)
  20.     {
  21.         var sheet = context.propertySheets.Get(Shader.Find("Hidden/Harryh___h/Highlight"));
  22.         sheet.properties.SetFloat("_Scale", settings.scale);
  23.         sheet.properties.SetFloat("_Shine", settings.shine);
  24.         sheet.properties.SetFloat("_Shadow", settings.shadow);
  25.         sheet.properties.SetFloat("_Rotations", settings.rotations);
  26.         sheet.properties.SetFloat("_DepthThreshold", settings.depthThreshold);
  27.  
  28.         context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
  29.     }
  30. }
Add Comment
Please, Sign In to add comment