Sharpen
From GameStudio Wiki
[edit]
Lite-C:
Material and function to adjust the effect:
//Sharpen
MATERIAL* Sharpen_mat =
{
effect = "sharpen.fx";
}
function Sharpen_set_Value(strength)
{
Sharpen_mat.skill1 = floatv(strength); // should be higher than one. Looks good between 10 and 50
}
The sharpen.fx file:
//////////////////////////////////////////////////////
////sharpens the screen depending on vecSkill1[0]////
//////////////////////////////////////////////////////
texture TargetMap;
float4 vecSkill1;
sampler postTex = sampler_state
{
texture = (TargetMap);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 Sharpen_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
Color = tex2D( postTex, Tex.xy);
Color -= tex2D( postTex, Tex.xy+0.0001)*vecSkill1[0];
Color += tex2D( postTex, Tex.xy-0.0001)*vecSkill1[0];
Color.a = 1.0;
return Color;
}
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_2_0 Sharpen_PS();
}
}
technique fallback { pass one { } }
[edit]
C-Script
Material and function to adjust the effect:
//Sharpen
material Sharpen_mat
{
effect = "sharpen.fx";
}
function Sharpen_set_Value(strength)
{
Sharpen_mat.skill1 = floatv(strength); // should be higher than one. Looks good between 10 and 50
}
The sharpen.fx file:
//////////////////////////////////////////////////////
////sharpens the screen depending on vecSkill1[0]////
//////////////////////////////////////////////////////
texture entSkin1;
float4 vecSkill1;
sampler postTex = sampler_state
{
texture = (entSkin1);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 Sharpen_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
Color = tex2D( postTex, Tex.xy);
Color -= tex2D( postTex, Tex.xy+0.0001)*vecSkill1[0];
Color += tex2D( postTex, Tex.xy-0.0001)*vecSkill1[0];
Color.a = 1.0;
return Color;
}
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_2_0 Sharpen_PS();
}
}
technique tech_01
{
pass pass_00
{
Texture[0] = <entSkin1>;
}
}
--Slin 01:01, 11 November 2007 (CET)
