//Cg void vshader( float4 vtx_position : POSITION, float2 vtx_texcoord0 : TEXCOORD0, out float4 l_position : POSITION, out float2 l_texcoord0 : TEXCOORD0, out float2 l_texcoord1 : TEXCOORD1, uniform float4 texpad_tex, uniform float4x4 mat_modelproj) { l_position=mul(mat_modelproj, vtx_position); l_texcoord0 = vtx_position.xz * texpad_tex.xy + texpad_tex.xy; l_texcoord1 = l_position.xy; } void fshader(float2 l_texcoord0 : TEXCOORD0, float2 l_texcoord1 : TEXCOORD1, out float4 o_color : COLOR, uniform sampler2D k_tex : TEXUNIT0) { float4 c = tex2D(k_tex, l_texcoord0); // basic black and white effet float bright = (c.x + c.y + c.z)/3; // create a vignette to simulate old optics float d = distance(float2(0.0, 0.0), l_texcoord1); float OuterVignetting = 1.6; float InnerVignetting = 0.6; float vignetting = clamp((OuterVignetting - d) / (OuterVignetting - InnerVignetting), 0.0, 1.0); // non-linear fade to prevent ugly border effect float diff = 1.0 - vignetting; bright *= 1.0 - (diff * diff); o_color = float4(bright, bright, bright, 1); }