port from perforce
This commit is contained in:
46
evoke-64k/ev10/cfg/psrainbow.txt
Normal file
46
evoke-64k/ev10/cfg/psrainbow.txt
Normal file
@@ -0,0 +1,46 @@
|
||||
float4 g_fResolution : register(c0);
|
||||
float3 g_vLightDir : register(c1);
|
||||
|
||||
sampler2D tex : register(s0);
|
||||
sampler1D dif : register(s2);
|
||||
sampler1D spec : register(s3);
|
||||
sampler2D shadowSampler : register(s4);
|
||||
sampler2D depthSampler : register(s5);
|
||||
|
||||
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
|
||||
|
||||
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);
|
||||
|
||||
float4 fColor = i.c * tex2D( tex, i.t );
|
||||
float fS= 0.125f + 0.875f * tex2D(shadowSampler, sc);
|
||||
|
||||
// Lighting
|
||||
fColor.xyz *= tex1D(dif, fS * ( 0.5f + 0.5f * dot( i.n, -g_vLightDir) ));
|
||||
|
||||
// Specular highlights
|
||||
float3 h = normalize( normalize(i.v) + -g_vLightDir );
|
||||
float s = dot(i.n, h);
|
||||
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
|
||||
|
||||
// Red-only glow
|
||||
// fColor.a = saturate(fColor.a + 1.f - fColor.r);
|
||||
|
||||
return fColor;
|
||||
}
|
||||
Reference in New Issue
Block a user