Security Cam
From GameStudio Wiki
Thanks to ello for sharing this shader!
[edit]
Lite-C:
Material and function to adjust the effect:
//Security Cam
MATERIAL* SecurityCam_mat =
{
effect = "SecurityCamPP.fx";
}
function SecurityCam_set_Value(Density,MovementSpeed)
{
SecurityCam_mat.skill1 = floatv(Density); //1 looks good
SecurityCam_mat.skill2 = floatv(MovementSpeed); // about 3
}
The SecurityCamPP.fx file:
//creates dark lines over the screen
float4 vecViewPort; // contains viewport pixel size in zw components
float4 vecTime; //contains some time variables
float4 vecSkill1; //vecSkill1.x is the density of the lines and vecSkill1.y is their movementspeed
Texture TargetMap;
sampler2D smpSource = sampler_state { texture = <TargetMap>; };
float4 mainPS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D( smpSource, Tex.xy);
Color *= 0.75 + 0.25*sin((Tex.y/vecViewPort.w-vecTime.w*vecSkill1.y)*vecSkill1.x);
return Color;
}
technique fx1
{
pass p1
{
PixelShader = compile ps_2_0 mainPS();
}
}
[edit]
C-Script
Material and function to adjust the effect:
//Security Cam
material SecurityCam_mat
{
effect = "SecurityCamPP.fx";
}
function SecurityCam_set_Value(Density,MovementSpeed)
{
SecurityCam_mat.skill1 = floatv(Density); //1 looks good
SecurityCam_mat.skill2 = floatv(MovementSpeed); // about 3
}
The SecurityCamPP.fx file:
//creates dark lines over the screen
float4 vecViewPort; // contains viewport pixel size in zw components
float4 vecTime; //contains some time variables
float4 vecSkill1; //vecSkill1.x is the density of the lines and vecSkill1.y is their movementspeed
Texture entSkin1;
sampler2D smpSource = sampler_state { texture = <entSkin1>; };
float4 mainPS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = tex2D( smpSource, Tex.xy);
Color *= 0.75 + 0.25*sin((Tex.y/vecViewPort.w-vecTime.w*vecSkill1.y)*vecSkill1.x);
return Color;
}
technique fx1
{
pass p1
{
PixelShader = compile ps_2_0 mainPS();
}
}
--Slin 01:38, 17 November 2007 (CET)
