同步-后处理调整

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

@@ -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);