using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using Debug = UnityEngine.Debug; public class GlitchFeature : ScriptableRendererFeature { [Serializable] public class Settings { public RenderTexture glitchTex; public RenderTexture stencilTex; public RenderTexture blendTex; public Material blendMat; public Material fadeMat; public Material stencilMat; public float sample; public float fadeStrength; } [SerializeField] private Settings _settings = new Settings(); private GlitchPass _glitchPass; private BlendPass _blendPass; private GlitchStencilPass _stencilPass; public override void Create() { _blendPass = new BlendPass(_settings); _glitchPass = new GlitchPass(); _stencilPass = new GlitchStencilPass(_settings); } public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { // get glitch stencil information _stencilPass.renderPassEvent = RenderPassEvent.AfterRendering; renderer.EnqueuePass(_stencilPass); _blendPass.renderPassEvent = RenderPassEvent.BeforeRenderingPostProcessing; renderer.EnqueuePass(_blendPass); // _glitchPass.renderPassEvent = RenderPassEvent.AfterRenderingOpaques; // _glitchPass.Settings = _settings; // renderer.EnqueuePass(_glitchPass); } }