功能完善

This commit is contained in:
ShrlAlgo
2025-08-20 12:10:13 +08:00
parent d0cfc64450
commit fcd306b0f7
270 changed files with 11503 additions and 7193 deletions

View File

@@ -0,0 +1,20 @@
sampler2D inputTex : register(S0);
//范围-1~1
float brightness : register(C0);
//范围-1~1
float contrast : register(C1);
static const float PI = 3.14159265f;
float4 main(float2 uv : TEXCOORD) : COLOR
{
//UI的源颜色
float4 sourceColor = tex2D(inputTex, uv);
//计算对比度系数
float k = tan((45 + 44 * contrast) / 180 * PI);
//计算亮度对比度
float4 outColor = (sourceColor - 0.5 * (1 - brightness)) * k + 0.5 * (1 + brightness);
return outColor;
}

Binary file not shown.

View File

@@ -0,0 +1,10 @@
@echo off
setlocal
set FXC_PATH="C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\fxc.exe"
%FXC_PATH% NeumorphismShadowEffect.fx /T ps_3_0 /Fo NeumorphismShadowEffect.ps
echo.
echo press any key to finish.
pause > nul

View File

@@ -0,0 +1,28 @@
sampler2D inputTex : register(S0);
float2 mousePos : register(C0);
float2 uiSize : register(C1);
float lightSize : register(C2);
float intensity : register(C3);
float4 lightColor : register(C4);
static const float PI = 3.14159265f;
float4 main(float2 uv : TEXCOORD) : COLOR
{
//UI的源颜色
float4 sourceColor = tex2D(inputTex, uv);
//计算当前UV值的实际尺寸坐标
float xPos = uv.x * uiSize.x;
float yPos = uv.y * uiSize.y;
//计算当前片元和鼠标位置的实际距离
float distanceMouseFrag = length(float2(xPos - mousePos.x, yPos - mousePos.y));
//归一化距离(0~1)
float uniformedDistance = min(distanceMouseFrag / lightSize,1);
//距离转渐进强度(1~0)
float intensityFrag = cos(uniformedDistance * PI) / 2.0f + 0.5f;
//计算线性减淡
float3 linearDodge = sourceColor.xyz + lightColor.xyz * intensityFrag * intensity * sourceColor.a;
return float4(linearDodge, sourceColor.a);
}

Binary file not shown.