We are going to use the previous code, but we have to add and delete a lot:
Start with the fragment program. Besides the normal parameter, add a
float4
uniform parameter to store the color channel factors. Use these factors to multiply the color we retrieved from the original scene texture:void MyFragmentShader10(float2 uv : TEXCOORD0, out float4 color : COLOR, uniform sampler2D texture, uniform float4 factors ) { color = tex2D(texture, uv); color *= factors; }
Create a new material that uses the fragment shader and add the parameter with the default value of (1,1,1,0). This means that without changing the parameter, the scene will be rendered normally:
fragment_program MyFragmentShader10 cg { source Ogre3DBeginnerGuideShaders.cg entry_point MyFragmentShader10 profiles ps_1_1 arbfp1 default_params { param_named factors float4 1 1 1 0 } } material Ogre3DBeginnersGuide/Comp7 { technique { pass { fragment_program_ref MyFragmentShader10 { } texture_unit...