Files
Cielonos/Assets/Shaders/ScriptablePostProcessor/Volumes/SpeedLines.cs
SoulliesOfficial f26f9fd374 爆更
2026-03-20 12:07:44 -04:00

49 lines
2.5 KiB
C#

using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSUtilities.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Speed Lines")]
public class SpeedLines : ScriptablePostProcessorVolume
{
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
public override int OrderInInjectionPoint => 20;
[Header("Effect Color & Intensity")]
public ColorParameter color = new(new Color(1f, 1f, 1f, 0.5f), true, true, true);
[Header("Lines")]
public FloatParameter speedLinesTiling = new(200f);
public ClampedFloatParameter speedLinesRadialScale = new(0.1f, 0f, 10f);
public FloatParameter speedLinesPower = new(0f);
public ClampedFloatParameter speedLinesRemap = new(1f, 0f, 1f);
public FloatParameter speedLinesAnimation = new(3f);
[Header("Radial Mask")]
public ClampedFloatParameter maskScale = new(1f, 0f, 2f);
public ClampedFloatParameter maskHardness = new(0f, 0f, 1f);
public FloatParameter maskPower = new(5f);
public override string GetShaderName() => "SLS/Postprocessing/SpeedLines";
public override bool IsActive() => speedLinesRemap.value < 1f && color.value.a > 0f;
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle target)
{
if (material == null) return;
material.SetColor(InternalShaderHelpers.ID._SpeedLinesColour, color.value);
material.SetFloat(InternalShaderHelpers.ID._SpeedLinesTiling, speedLinesTiling.value);
material.SetFloat(InternalShaderHelpers.ID._SpeedLinesRadialScale, speedLinesRadialScale.value);
material.SetFloat(InternalShaderHelpers.ID._SpeedLinesPower, speedLinesPower.value);
material.SetFloat(InternalShaderHelpers.ID._SpeedLinesRemap, speedLinesRemap.value);
material.SetFloat(InternalShaderHelpers.ID._SpeedLinesAnimation, speedLinesAnimation.value);
material.SetFloat(InternalShaderHelpers.ID._MaskScale, maskScale.value);
material.SetFloat(InternalShaderHelpers.ID._MaskHardness, maskHardness.value);
material.SetFloat(InternalShaderHelpers.ID._MaskPower, maskPower.value);
Blitter.BlitCameraTexture(cmd, source, target, material, 0);
}
}
}