同步-后处理调整

This commit is contained in:
SoulliesOfficial
2026-07-09 17:10:17 -04:00
parent d474a8929c
commit 2b01d76bf4
21 changed files with 150 additions and 105 deletions

View File

@@ -213,7 +213,7 @@ Material:
- _Dst: 10
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EdgeValue: 0.93644387
- _EdgeValue: 0.30297375
- _EnvironmentReflections: 1
- _FNLfanxiangkaiguan: 0
- _Face: 1
@@ -258,7 +258,7 @@ Material:
- _Mask_scale: 1
- _Metallic: 0
- _OcclusionStrength: 1
- _Opacity: 0.063556135
- _Opacity: 0.69702625
- _Parallax: 0.005
- _Pass: 0
- _QueueOffset: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de233eed6b857cc4b9577804ccd84680
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3977ac8aeca6a7342901ef341d55891d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 59fa770367ea1e247bb76f22eab57a75
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
€(<28>œx5¿f<C2BF>^ ‰%œd¤ Ü~æQF¦­ à°ÉO(DÓ¶Hð#‰ƒ²s? ')8á<>šðGþtáÔK"MŠþس݃"ódgÿÖ"à'áª;y
F.Ю|[…=Eб•gјTЬъЄѕЙcяп—иNНTJ)Ё—L«Ра њtЛв@€CB6Њ©ф…ф{<+В$ и.fDЭ=5%Т•AЙeV|я8ъћЦ‡mЌсџ2FЙu4љ$K)lsQ)­dnРЏr

View File

@@ -1 +1 @@
!ÕØ!éÆLú²«Ñ sð4Kš8fHw7éL -à8Lv<4C>»Ò³<ª½ Cw=åò-êIa±øÙ@ðï—â©<C3A2>TùNr]ç)N}+µ$ŠÏÎPT"á²CwÊF<C38A>ŠNnÏ%eç 1k<31>ÁýŠ3<>`vè59È‚ô ŸJÀ;óÕá¡ra0C$ÁеrÉèÙcAIhO»í8A7úõËå¸Ñ7£Á.Al~ ',–…ÒtØ0²KL¶ÌŒ<C38C>7õbmþÄø¡¯?މù Z6ŽÖ¥
߇XDWť*=ßŢ@Ć·żçmrżáď nť}aŐ[dlmqŁ™ăK«k$Ü޵¦8ČE éZ—M/ç#Ě!0ę

View File

@@ -4,8 +4,8 @@ namespace Ichni.RhythmGame.Beatmap
{
public class PixelateEffect_BM : EffectBase_BM
{
public float bottomX;
public float bottomY;
[Range(0f, 1f)] public float bottomX;
[Range(0f, 1f)] public float bottomY;
public AnimationCurve intensityCurve;
public PixelateEffect_BM() { }
@@ -13,8 +13,8 @@ namespace Ichni.RhythmGame.Beatmap
public PixelateEffect_BM(float effectTime, float bottomX, float bottomY, AnimationCurve intensityCurve)
{
this.effectTime = effectTime;
this.bottomX = bottomX;
this.bottomY = bottomY;
this.bottomX = Mathf.Clamp01(bottomX);
this.bottomY = Mathf.Clamp01(bottomY);
this.intensityCurve = intensityCurve;
}

View File

@@ -7,8 +7,8 @@ namespace Ichni.RhythmGame
public class PixelateEffect : EffectBase
{
#region [] Effect Parameters
public float bottomX;
public float bottomY;
[Range(0f, 1f)] public float bottomX;
[Range(0f, 1f)] public float bottomY;
public AnimationCurve intensityCurve;
private PixelateVolume _pixelateVolume;
@@ -19,8 +19,8 @@ namespace Ichni.RhythmGame
: base(effectTime) // 激活受控时间分段
{
this.effectTime = effectTime;
this.bottomX = bottomX;
this.bottomY = bottomY;
this.bottomX = Mathf.Clamp01(bottomX);
this.bottomY = Mathf.Clamp01(bottomY);
this.intensityCurve = intensityCurve;
}
@@ -41,8 +41,8 @@ namespace Ichni.RhythmGame
if (_pixelateVolume != null)
{
_pixelateVolume.forceActive.value = true;
_pixelateVolume.strengthX.value = Screen.width;
_pixelateVolume.strengthY.value = Screen.height;
_pixelateVolume.strengthX.value = 1f;
_pixelateVolume.strengthY.value = 1f;
}
}
@@ -50,8 +50,9 @@ namespace Ichni.RhythmGame
{
if (_pixelateVolume != null)
{
float x = Mathf.Lerp(Screen.width, bottomX, intensityCurve.Evaluate(effectProgressPercent));
float y = Mathf.Lerp(Screen.height, bottomY, intensityCurve.Evaluate(effectProgressPercent));
float progress = intensityCurve == null ? effectProgressPercent : intensityCurve.Evaluate(effectProgressPercent);
float x = Mathf.Lerp(1f, Mathf.Clamp01(bottomX), progress);
float y = Mathf.Lerp(1f, Mathf.Clamp01(bottomY), progress);
_pixelateVolume.strengthX.value = x;
_pixelateVolume.strengthY.value = y;
@@ -67,8 +68,8 @@ namespace Ichni.RhythmGame
if (_pixelateVolume != null)
{
_pixelateVolume.forceActive.value = false;
_pixelateVolume.strengthX.value = Screen.width;
_pixelateVolume.strengthY.value = Screen.height;
_pixelateVolume.strengthX.value = 1f;
_pixelateVolume.strengthY.value = 1f;
}
}
#endregion

Binary file not shown.

View File

@@ -23,15 +23,14 @@ Shader "Hidden/Custom/Pixelate"
half4 Frag(Varyings input) : SV_Target
{
float2 uv = input.texcoord;
float2 strength = float2(_PixelateStrengthX, _PixelateStrengthY);
// 防止除数为0的极小可能崩溃
strength = max(strength, float2(1.0, 1.0));
float2 resolutionRatio = saturate(float2(_PixelateStrengthX, _PixelateStrengthY));
// 使用当前渲染目标分辨率,而不是设备固定分辨率,兼容动态分辨率和渲染缩放。
float2 targetResolution = max(floor(_ScreenParams.xy * resolutionRatio), float2(1.0, 1.0));
float2 uvScaled = uv * strength;
float2 uvScaled = uv * targetResolution;
float2 uvFloor = floor(uvScaled);
float2 uvCenter = uvFloor + 0.5;
float2 uvPixelated = uvCenter / strength;
float2 uvPixelated = uvCenter / targetResolution;
// Blitter框架将自动把 SourceTexture 注入为 _BlitTexture
return SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uvPixelated);

View File

@@ -15,9 +15,12 @@ namespace SLSUtilities.Rendering.PostProcessing
[Tooltip("是否强制开启像素化效果")]
public BoolParameter forceActive = new BoolParameter(false);
public FloatParameter strengthX = new FloatParameter(1920f);
public FloatParameter strengthY = new FloatParameter(1080f);
[Tooltip("横向分辨率比例0 到 11 为当前渲染分辨率")]
public FloatParameter strengthX = new FloatParameter(1f);
[Tooltip("纵向分辨率比例0 到 11 为当前渲染分辨率")]
public FloatParameter strengthY = new FloatParameter(1f);
// 返回我们在 Shader 里定义的名字,保证管家可以据此获取材质
public override string GetShaderName() => "Hidden/Custom/Pixelate";
@@ -32,11 +35,11 @@ namespace SLSUtilities.Rendering.PostProcessing
{
if (material == null) return;
cmd.SetGlobalFloat(InternalShaderHelpers.ID._PixelateStrengthX, strengthX.value);
cmd.SetGlobalFloat(InternalShaderHelpers.ID._PixelateStrengthY, strengthY.value);
cmd.SetGlobalFloat(InternalShaderHelpers.ID._PixelateStrengthX, Mathf.Clamp01(strengthX.value));
cmd.SetGlobalFloat(InternalShaderHelpers.ID._PixelateStrengthY, Mathf.Clamp01(strengthY.value));
// 使用你的统一管家分发的 Blitter 进行优雅渲染
Blitter.BlitCameraTexture(cmd, source, destination, material, 0);
}
}
}
}