home打开关闭逻辑修改调整提交

This commit is contained in:
2026-02-04 09:11:27 +08:00
parent 10c6fabd73
commit c7676793d5
36 changed files with 2023 additions and 708 deletions

View File

@@ -1,77 +0,0 @@
Shader "Hidden/URP/DualKawaseBlur"
{
SubShader
{
Tags { "RenderPipeline"="UniversalPipeline" }
ZWrite Off ZTest Always Cull Off
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
// RenderGraph AddBlitPass 默认绑定的属性:
TEXTURE2D_X(_BlitTexture);
SAMPLER(sampler_LinearClamp);
float4 _BlitTexture_TexelSize;
float4 _BlitScaleBias; // xy scale, zw bias
float _Offset;
struct Attributes { float4 positionOS:POSITION; float2 uv:TEXCOORD0; };
struct Varyings { float4 positionHCS:SV_POSITION; float2 uv:TEXCOORD0; };
Varyings vert(Attributes v)
{
Varyings o;
o.positionHCS = TransformObjectToHClip(v.positionOS.xyz);
o.uv = v.uv;
return o;
}
float2 BlitUV(float2 uv) { return uv * _BlitScaleBias.xy + _BlitScaleBias.zw; }
half4 DownsampleFrag(Varyings i) : SV_Target
{
float2 uv = BlitUV(i.uv);
float2 d = _BlitTexture_TexelSize.xy * _Offset;
half4 c = 0;
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv) * 0.5;
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2( d.x, d.y)) * 0.125;
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2(-d.x, d.y)) * 0.125;
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2( d.x, -d.y)) * 0.125;
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2(-d.x, -d.y)) * 0.125;
return c;
}
half4 UpsampleFrag(Varyings i) : SV_Target
{
float2 uv = BlitUV(i.uv);
float2 d = _BlitTexture_TexelSize.xy * _Offset;
half4 c = 0;
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2( d.x, d.y));
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2(-d.x, d.y));
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2( d.x, -d.y));
c += SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv + float2(-d.x, -d.y));
return c * 0.25;
}
ENDHLSL
Pass
{
Name "Downsample"
HLSLPROGRAM
#pragma vertex vert
#pragma fragment DownsampleFrag
ENDHLSLPROGRAM
}
Pass
{
Name "Upsample"
HLSLPROGRAM
#pragma vertex vert
#pragma fragment UpsampleFrag
ENDHLSLPROGRAM
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 049554a5919b4543b166b26c451603ec
timeCreated: 1770108188

View File

@@ -0,0 +1,61 @@
Shader "Hidden/SimpleGaussianBlur"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {} _BlurSize ("Blur Size", Float) = 1
}
SubShader
{
Tags
{
"RenderType"="Opaque"
}
Pass
{
ZTest Always Cull Off ZWrite Off
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_TexelSize;
float _BlurSize;
float2 _Direction; // (1,0)=horizontal, (0,1)=vertical
struct appdata
{
float4 vertex:POSITION;
float2 uv:TEXCOORD0;
};
struct v2f
{
float4 pos:SV_POSITION;
float2 uv:TEXCOORD0;
};
v2f vert(appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag(v2f i):SV_Target
{
float2 texel = _MainTex_TexelSize.xy * _BlurSize * _Direction;
// 9-tap weights近似高斯
fixed4 c = tex2D(_MainTex, i.uv) * 0.227027f;
c += tex2D(_MainTex, i.uv + texel * 1.384615f) * 0.316216f;
c += tex2D(_MainTex, i.uv - texel * 1.384615f) * 0.316216f;
c += tex2D(_MainTex, i.uv + texel * 3.230769f) * 0.070270f;
c += tex2D(_MainTex, i.uv - texel * 3.230769f) * 0.070270f;
return c;
}
ENDHLSL
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ffeb19bc523c4332bd9a997945294325
timeCreated: 1770122445