Advanced Computer Graphics: Laboratory Project

<< PREV | INDEX | NEXT >>

Task 3A: Create an 'Invert' Effect

Solution

Create a new technique:

technique invert
{
	pass invertPass
	{
		FragmentProgram = compile arbfp1 psInvert(framebufferSampler);
	}
}

Create the fragment shader:

float4 psInvert(float2 tex0 : TEXCOORD0, uniform samplerRECT framebufferSampler) : COLOR
{
	float4 framebuffer = texRECT(framebufferSampler, tex0);

	return 1 - framebuffer;
}

<< PREV | INDEX | NEXT >>