Files
bluflame/evoke-64k/bp10/cfg/pstext.txt
2026-04-18 22:31:51 +02:00

44 lines
1.1 KiB
Plaintext

float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {1.15f, 1.05f, 1.0f, 1.25f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float3 fColor = float3( 0.25f, 0.3f, 0.4f );
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot( n, h);
fColor += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return float4(fColor, 1.0f);
}