Monochrome

From GameStudio Wiki

Jump to: navigation, search

Lite-C:


The material for the effect:

// Monochrome
MATERIAL* Monochrome_mat =
{
	effect = "monochrome.fx";
}

The monochrome.fx file:

texture TargetMap;

sampler postTex = sampler_state
{
	texture 	= (TargetMap);
	MinFilter	= linear;
	MagFilter	= linear;
	MipFilter	= linear;
	AddressU		= Clamp;
	AddressV		= Clamp;
};

float4 Monochrom_PS(float2 tex : TEXCOORD0) : COLOR
{
	float4 Color = tex2D(postTex,tex);
	
	Color.rgb = (Color.r+Color.g+Color.b)/3.0f;
	
	return Color;
}

technique tech_00
{
	pass pass_00
	{
		VertexShader = null;
		PixelShader = compile ps_2_0 Monochrom_PS();
	}
}

technique fallback { pass one { } }


C-Script


The material for the effect:

// Monochrome
material Monochrome_mat
{
	effect = "monochrome.fx";
}

The monochrome.fx file:

texture entSkin1;

sampler postTex = sampler_state
{
	texture 	= (entSkin1);
	MinFilter	= linear;
	MagFilter	= linear;
	MipFilter	= linear;
	AddressU		= Clamp;
	AddressV		= Clamp;
};

float4 Monochrom_PS(float2 tex : TEXCOORD0) : COLOR
{
	float4 Color = tex2D(postTex,tex);
	
	Color.rgb = (Color.r+Color.g+Color.b)/3.0f;
	
	return Color;
}

technique tech_00
{
	pass pass_00
	{
		VertexShader = null;
		PixelShader = compile ps_2_0 Monochrom_PS();
	}
}

technique tech_01
{
	pass pass_00
	{
		Texture[0] = <entSkin1>;
	}
}

--Slin 23:30, 10 November 2007 (CET)

Personal tools