Simple Blur
From GameStudio Wiki
[edit]
Lite-C:
Material and function to adjust the effect:
// Blur in all directions (Lowquality)
MATERIAL* SimpleBlur_mat =
{
effect = "simpleBlur.fx";
}
function SimpleBlur_set_Value(Blur)
{
SimpleBlur_mat.skill1 = floatv(Blur); // should be higher than 1
}
The simpleBlur.fx file:
//////very simple blur in each direction//////
texture TargetMap;
float4 vecSkill1;
sampler postTex = sampler_state
{
texture = (TargetMap);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 SimpleBlur_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
Color = tex2D(postTex, Tex.xy);
Color += tex2D(postTex, Tex.xy+0.001*vecSkill1[0]);
Color += tex2D(postTex, Tex.xy-0.001*vecSkill1[0]);
Color /= 3;
return Color;
}
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_2_0 SimpleBlur_PS();
}
}
technique fallback { pass one { } }
[edit]
C-Script
Material and function to adjust the effect:
// Blur in all directions (Lowquality)
material SimpleBlur_mat
{
effect = "simpleBlur.fx";
}
function SimpleBlur_set_Value(Blur)
{
SimpleBlur_mat.skill1 = floatv(Blur); // should be higher than 1
}
The simpleBlur.fx file:
//////very simple blur in each direction//////
texture entSkin1;
float4 vecSkill1;
sampler postTex = sampler_state
{
texture = (entSkin1);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 SimpleBlur_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color;
Color = tex2D(postTex, Tex.xy);
Color += tex2D(postTex, Tex.xy+0.001*vecSkill1[0]);
Color += tex2D(postTex, Tex.xy-0.001*vecSkill1[0]);
Color /= 3;
return Color;
}
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_2_0 SimpleBlur_PS();
}
}
technique tech_01
{
pass pass_00
{
Texture[0] = <entSkin1>;
}
}
--Slin 00:47, 11 November 2007 (CET)
