using Echovoid.Runtime.Behavior.Rendering; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; namespace SLSUtilities.Rendering.PostProcessing { [System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Hyper Tunnel")] public class HyperTunnel : ScriptablePostProcessorVolume { public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess; // Run after basic effects, probably before UI public override int OrderInInjectionPoint => 55; [Header("Global Pulse Color")] [Tooltip("Emission Color of the Speed Lines. Alpha controls opacity multiplier.")] public ColorParameter color = new(new Color(0f, 1f, 1f, 1f), true, true, true); [Header("Speed Lines Effect")] [Tooltip("Luminosity of the speed lines.")] public ClampedFloatParameter lineIntensity = new(0f, 0f, 10f); [Tooltip("The speed at which the lines fly out of the center.")] public FloatParameter baseSpeed = new(30f); [Header("Distortion & Blur")] [Tooltip("How strongly the environment is pulled into a radial motion blur.")] public ClampedFloatParameter radialBlurAmount = new(0f, 0f, 0.2f); [Tooltip("RGB split dispersion amount when pulsing.")] public ClampedFloatParameter chromaticAberration = new(0f, 0f, 5f); [Header("VFX Center")] [Tooltip("The vanishing point (0.5, 0.5 is the exact screen center)")] public Vector2Parameter vfxCenter = new(new Vector2(0.5f, 0.5f)); public override string GetShaderName() => "SLS/Postprocessing/HyperTunnel"; public override bool IsActive() => (lineIntensity.value > 0f || radialBlurAmount.value > 0f || chromaticAberration.value > 0f); public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle target) { if (material == null) return; material.SetColor(InternalShaderHelpers.ID._HyperTunnelColor, color.value); Vector4 p = new Vector4(baseSpeed.value, lineIntensity.value, radialBlurAmount.value, chromaticAberration.value); material.SetVector(InternalShaderHelpers.ID._HyperTunnelParams, p); material.SetVector(InternalShaderHelpers.ID._HyperTunnelCenter, vfxCenter.value); Blitter.BlitCameraTexture(cmd, source, target, material, 0); } } }