Oldscool
From GameStudio Wiki
Thanks to ello for sharing this shader!
[edit]
Lite-C:
Material and function to adjust the effect:
//Oldscool
MATERIAL* Oldscool_mat =
{
effect ="Oldscool.fx";
}
function Oldscool_set_Value(Pixelation_x,Pixelation_y)
{
Oldscool_mat.skill1 = floatv(Pixelation_x); //100 looks good
Oldscool_mat.skill2 = floatv(Pixelation_y); //should be the same as above
}
The Oldscool.fx file:
//Makes the game to look as if it had a very low resolution
texture TargetMap;
sampler2D smpSource = sampler_state { texture = <TargetMap>; };
float4 vecViewPort;
float4 vecSkill1;
float4 blockyPS( float2 Tex : TEXCOORD0 ) : COLOR0
{
Tex.x = round(Tex.x*vecSkill1[0])/vecSkill1[0];
Tex.y = round(Tex.y*vecSkill1[1])/vecSkill1[1];
return tex2D(smpSource,Tex.xy);
}
technique postFX
{
pass p1
{
PixelShader = compile ps_2_0 blockyPS();
}
}
technique fallback { pass one { } }
[edit]
C-Script
Material and function to adjust the effect:
//Oldscool
material Oldscool_mat
{
effect ="Oldscool.fx";
}
function Oldscool_set_Value(Pixelation_x,Pixelation_y)
{
Oldscool_mat.skill1 = floatv(Pixelation_x); //100 looks good
Oldscool_mat.skill2 = floatv(Pixelation_y); //should be the same as above
}
The Oldscool.fx file:
//Makes the game looking as if it has a very low resolution
texture entSkin1;
sampler postTex = sampler_state
{
texture = (entSkin1);
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 vecViewPort;
float4 vecSkill1;
float4 blockyPS( float2 Tex : TEXCOORD0 ) : COLOR0
{
Tex.x = round(Tex.x*vecSkill1[0])/vecSkill1[0];
Tex.y = round(Tex.y*vecSkill1[1])/vecSkill1[1];
return tex2D(postTex,Tex.xy);
}
technique postFX
{
pass p1
{
PixelShader = compile ps_2_0 blockyPS();
}
}
technique fallback { pass one { } }
--Slin 12:46, 11 November 2007 (CET)
