后处理+FEEL完全改进

This commit is contained in:
SoulliesOfficial
2025-12-22 18:36:29 -05:00
parent c3914da4ac
commit a2052bfe16
1427 changed files with 193092 additions and 374110 deletions

View File

@@ -0,0 +1,86 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Advanced Chromatic Aberration")]
public class AdvancedChromaticAberration : ScriptablePostProcessorVolume
{
// 建议放在 PostProcess 之后,作为最终的镜头效果
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
public override int OrderInInjectionPoint => 20;
[Header("Main Settings")]
[Tooltip("色散总强度")]
public ClampedFloatParameter intensity = new(0f, 0f, 1f);
[Tooltip("扩散中心点 (0.5, 0.5 为屏幕中心)")]
public Vector2Parameter center = new(new Vector2(0.5f, 0.5f));
[Tooltip("RGB 分离权重。控制每个通道向外扩散的程度。\n例如 (1, 0, -1) 会让红蓝向相反方向分离,绿色不动。")]
public Vector3Parameter channelSplit = new(new Vector3(1f, 0f, -1f));
[Header("Dispersion Map (Broken Glass/Glitch)")]
[Tooltip("输入的噪波贴图,用于打乱色散的方向")]
public TextureParameter dispersionMap = new(null);
[Tooltip("贴图对色散方向的影响力")]
public ClampedFloatParameter dispersionStrength = new(0f, 0f, 2f);
[Header("Jitter (Temporal Instability)")]
[Tooltip("UV 采样抖动强度")]
public ClampedFloatParameter jitterIntensity = new(0f, 0f, 1f);
[Tooltip("抖动速度")]
public FloatParameter jitterSpeed = new(10f);
[Header("Masking")]
[Tooltip("中心保留清晰的半径 (0-1)")]
public ClampedFloatParameter maskRadius = new(0.2f, 0f, 1f);
[Tooltip("遮罩边缘的软硬度")]
public ClampedFloatParameter maskHardness = new(0.2f, 0.01f, 1f);
protected override string GetShaderName() => "SLS/Postprocessing/AdvancedChromaticAberration";
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle destination)
{
if (material == null) return;
// Pack Params 1
Vector4 p1 = new Vector4(
intensity.value,
center.value.x,
center.value.y,
maskRadius.value
);
// Pack Params 2
Vector4 p2 = new Vector4(
jitterIntensity.value,
jitterSpeed.value,
dispersionStrength.value,
maskHardness.value
);
material.SetVector(InternalShaderHelpers.ID._ACA_Params1, p1);
material.SetVector(InternalShaderHelpers.ID._ACA_Params2, p2);
material.SetVector(InternalShaderHelpers.ID._ACA_Split, channelSplit.value);
if (dispersionMap.value != null)
{
material.SetTexture(InternalShaderHelpers.ID._DispersionMap, dispersionMap.value);
}
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
}
public override bool IsActive()
{
// 只要有强度,或者有抖动,就需要渲染
return intensity.value > 0f || jitterIntensity.value > 0f;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d692dfd6cc3001c4993ac48b98cf416c

View File

@@ -0,0 +1,63 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Advanced Vignette")]
public class AdvancedVignette : ScriptablePostProcessorVolume
{
// 放在最最后
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
public override int OrderInInjectionPoint => 100;
[Header("Gradient Colors")]
[Tooltip("外部颜色(边缘)。最暗的地方显示的颜色。")]
public ColorParameter colorOuter = new(Color.black, true, true, true);
[Tooltip("内部颜色(过渡区)。\n当暗角开始出现时显示的颜色。\n设为与外部相同则为单色暗角。\n设为红色可做受伤效果。")]
public ColorParameter colorInner = new(Color.black, true, true, true);
[Header("Shape Settings")]
[Tooltip("中心位置")]
public Vector2Parameter center = new(new Vector2(0.5f, 0.5f));
[Tooltip("强度。0 = 无效果")]
public ClampedFloatParameter intensity = new(0f, 0f, 1f);
[Tooltip("柔和度。控制渐变区域的宽度。")]
public ClampedFloatParameter smoothness = new(0.5f, 0.01f, 1f);
[Tooltip("圆度。1 = 圆形0 = 方形。")]
public ClampedFloatParameter roundness = new(1f, 0f, 1f);
protected override string GetShaderName() => "SLS/Postprocessing/AdvancedVignette";
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle destination)
{
if (material == null) return;
material.SetColor(InternalShaderHelpers.ID._ColorInner, colorInner.value);
material.SetColor(InternalShaderHelpers.ID._ColorOuter, colorOuter.value);
material.SetVector(InternalShaderHelpers.ID._VignetteCenter, center.value);
// Pack Params
Vector3 p1 = new Vector3(
intensity.value,
smoothness.value,
roundness.value
);
material.SetVector(InternalShaderHelpers.ID._VignetteParams1, p1);
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
}
public override bool IsActive()
{
return intensity.value > 0f;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4b3eae192e53bb542bb66bee3b8ac936

View File

@@ -0,0 +1,36 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/RGBSplitGlitch")]
public class RGBSplitGlitch : ScriptablePostProcessorVolume
{
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess;
public override int OrderInInjectionPoint => 0;
public ClampedFloatParameter intensity = new(0f, 0f, 1f);
public ClampedFloatParameter speed = new(10f, 0f, 100f);
protected override string GetShaderName() => "SLS/Postprocessing/RGBSplitGlitch";
private float elapsedTime = 1.0f;
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle destination)
{
if (material == null) return;
elapsedTime += Time.unscaledDeltaTime;
if (elapsedTime > 100)
{
elapsedTime = 0;
}
cmd.SetGlobalVector(InternalShaderHelpers.ID._RGBSplitGlitchParams,
new Vector4(intensity.value * 0.01f, Mathf.Floor(elapsedTime * speed.value)));
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
}
public override bool IsActive() => intensity.value > 0f;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 308c07db68b430d46b6d74d0847371b4

View File

@@ -0,0 +1,39 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.Rendering.PostProcessing
{
public enum RadialBlurQuality
{
RadialBlur_4Tap_Fatest = 0,
RadialBlur_8Tap_Balance = 1,
RadialBlur_12Tap = 2,
RadialBlur_16Tap_Quality = 3,
}
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Radial Blur")]
public class RadialBlur : ScriptablePostProcessorVolume
{
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess;
public override int OrderInInjectionPoint => 10;
public EnumParameter<RadialBlurQuality> qualityLevel = new (RadialBlurQuality.RadialBlur_8Tap_Balance);
public ClampedFloatParameter blurRadius = new(0f, -1f, 1f);
public ClampedFloatParameter radialCenterX = new(0.5f, 0f, 1f);
public ClampedFloatParameter radialCenterY = new(0.5f, 0f, 1f);
protected override string GetShaderName() => "SLS/Postprocessing/RadialBlur";
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle target)
{
if (material == null) return;
cmd.SetGlobalVector(InternalShaderHelpers.ID._RadialBlurParams,
new Vector4(blurRadius.value * 0.02f, radialCenterX.value, radialCenterY.value));
Blitter.BlitCameraTexture(cmd, source, target, material, (int)qualityLevel.value);
}
public override bool IsActive() => !Mathf.Approximately(blurRadius.value, 0);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1f10b1f364acbb743804f8a970bce230

View File

@@ -0,0 +1,48 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Sharpen")]
public class Sharpen : ScriptablePostProcessorVolume
{
// 放在所有后处理之后,对最终画面进行锐化
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess;
// 排序靠后,确保是最后几步操作之一
public override int OrderInInjectionPoint => 10;
[Header("General Settings")]
[Tooltip("锐化强度。值越大画面越锋利。建议范围 0.5 - 2.0。过大会导致失真。")]
public ClampedFloatParameter sharpness = new(0f, 0f, 5f);
[Header("Optimizations (Visual Quality)")]
[Tooltip("对比度阈值(降噪)。\n只有当像素差异大于此值时才锐化。\n增加此值可避免平坦区域如天空、皮肤出现噪点。\n建议值0.01 - 0.05。")]
public ClampedFloatParameter threshold = new(0.01f, 0f, 0.2f);
[Tooltip("最大亮度钳制(防光晕)。\n限制像素亮度的最大变化幅度防止边缘出现刺眼的白边或黑边。\n减小此值可让锐化更自然。\n建议值0.1 - 0.3。")]
public ClampedFloatParameter clamp = new(0.2f, 0f, 1f);
protected override string GetShaderName() => "SLS/Postprocessing/Sharpen";
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle destination)
{
if (material == null) return;
Vector4 paramsVec = new Vector4(
sharpness.value,
threshold.value,
clamp.value,
0 // unused
);
material.SetVector(InternalShaderHelpers.ID._SharpnessParams, paramsVec);
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
}
// 只有强度大于 0 时才激活
public override bool IsActive() => sharpness.value > 0f;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 148ba37ea406c934ea39cee8e2dd1108

View File

@@ -0,0 +1,49 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.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);
protected 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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b67ae72a3d84887438324358c0932509

View File

@@ -0,0 +1,76 @@
using Echovoid.Runtime.Behavior.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace SLSFramework.Rendering.PostProcessing
{
[System.Serializable, VolumeComponentMenu("SLS/Postprocessing/Strobe Flash")]
public class StrobeFlash : ScriptablePostProcessorVolume
{
public override CustomPostProcessInjectionPoint InjectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess;
public override int OrderInInjectionPoint => 5;
[Header("Master Switch")]
public BoolParameter enableEffect = new(false);
[Header("Binary Colors")]
public ColorParameter colorHigh = new(Color.white);
public ColorParameter colorLow = new(Color.black);
[Header("Threshold & Flash")]
public ClampedFloatParameter grading = new(0.5f, 0f, 1f);
public BoolParameter autoFlash = new(false);
public FloatParameter frequency = new(15f);
public BoolParameter manualInvert = new(false);
[Header("Optimizations (Art Style)")]
[Tooltip("预模糊:消除地面的细碎噪点。")]
public ClampedFloatParameter noiseReduction = new(1.5f, 0f, 5f);
[Tooltip("柔化边缘:让黑白交界处不那么生硬。")]
public ClampedFloatParameter softness = new(0.05f, 0f, 0.5f);
[Header("Outline Settings")]
[Tooltip("描边粗细:建议值 1.0 - 2.0。如果太小可能看不见。")]
public ClampedFloatParameter outlineThickness = new(1f, 0f, 5f);
[Tooltip("描边敏感度阈值 (米):深度差超过此值才画线。\n解决地面全黑的关键参数\n建议值0.5 - 2.0。")]
public MinFloatParameter outlineThreshold = new(1.0f, 0f); // 默认设为 1米
[Tooltip("感光权重")]
public Vector3Parameter luminanceWeights = new(new Vector3(0.2126f, 0.7152f, 0.0722f));
protected override string GetShaderName() => "SLS/Postprocessing/StrobeFlash";
public override void Render(CommandBuffer cmd, ref RenderingData renderingData, RTHandle source, RTHandle destination)
{
if (material == null) return;
material.SetColor(InternalShaderHelpers.ID._StrobeColorHigh, colorHigh.value);
material.SetColor(InternalShaderHelpers.ID._StrobeColorLow, colorLow.value);
material.SetVector(InternalShaderHelpers.ID._LuminanceWeights, new Vector4(luminanceWeights.value.x, luminanceWeights.value.y, luminanceWeights.value.z, 0));
Vector4 paramsVec = new Vector4(
frequency.value,
grading.value,
autoFlash.value ? 1f : 0f,
manualInvert.value ? 1f : 0f
);
material.SetVector(InternalShaderHelpers.ID._StrobeParams, paramsVec);
// 更新:传入 outlineThreshold (w分量)
Vector4 advParamsVec = new Vector4(
noiseReduction.value,
softness.value,
outlineThickness.value,
outlineThreshold.value
);
material.SetVector(InternalShaderHelpers.ID._StrobeAdvParams, advParamsVec);
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
}
public override bool IsActive() => enableEffect.value;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6a1f971f558014244b688b0d0a91e039