I was also looking at that shader, but didn't perform any tests yet. Like yourself, I'm not that familiar with GLSL, but from what I do know, my guess is that the shader samples the diffuse map (diffuse here just means object's color component), which is probably the screen buffer itself, and then simply picks some colors from the convMap ("conversion Map" - probably that sepia gradient image) based on the values of diffuse color components. The picked colors then replace the original colors in the output, or if UseFadeAlpha is defined, the two are blended.
Now, those gl_ variables are predefined variables, apparently used for input/output.
The final, output color of the pixels (or rather, fragments) is set in the final lines, where the value of gl_FragColor.xyz is assigned.
Line by (relevant) line, I'm pretty sure that this is what's happening:
vec3 vDiffuseColor = texture2DRect(diffuseMap, gl_TexCoord[0].xy).xyz;
The vec3 type is simply a 3-component vector, so vDiffuseColor is used to store the input RGB components for the current pixel (more precisely, texel). The texture2DRect function just samples the diffuseMap texture, whereby texture coordinates, gl_TexCoord[0].xy, are automatically advanced by the shader.
So, after that line, vDiffuseColor should contain the original screen color. You can test this by simply ignoring vOutput, by writing
vOutput.xyz = vDiffuseColor;
(or maybe:
vOutput = vDiffuseColor;)
just under the vOutput calculation, and thus assigning vDiffuseColor to gl_FragColor intead. This should result in no changes (color-wise) when the sepia effect is invoked (didn't test yet though).
Now, for the B&W shader this line would go away, but I'd like to say what I think it does anyway:
vec3 vOutput = vec3(
texture1D(convMap, vDiffuseColor.x).x,
texture1D(convMap, vDiffuseColor.y).y,
texture1D(convMap, vDiffuseColor.z).z
);
Each of the texture1D() calls sets a color component of the output. Now, convMap is treated as a 1D texture, that is, it's just a row of pixels. The second cparameter to texture1D function is the coordinate into the texture, 0.0 being on the left, 1.0 being on the right. As color components are also (I think) stored as values in the [0.0, 1.0] range, the value of the diffuse color component is used as an "index" to the replacement pixel's color component in the 1D texture. So, assuming that convMap is that sepia tone gradient, higher original color values, closer to white, will tend to be replaced by colors on the right of the gradient, while darker, lower values, by colors on the left.
Now, if what I said about vDiffuseColor is the case, there's a relatively simple way to convert to black and white, based on luminosity of the pixel.
To convert a color RGB pixel to black and white (or rather grayscale) the same way as "Desaturate" works in Photoshop, you just need to add all of the color components together and divide with 3.
It should look something like this (if anyone here is good with GLSL, make additional coorections to this code if required, maybe I've overlooked something):
float outputColor = vDiffuseColor.x + vDiffuseColor.y + vDiffuseColor.z;
outputColor /= 3.0f;
vec3 vOutput = vec3(outputColor, outputColor, outputColor);
Will do a test soon. The real question is: can you make the game use this shader for a custom story, but not for the main game...
Yup, got grayscale image.
In case you're wondering why that map looks familiar - it's a small, stripped down test map I made from the original first level of amnesia (near the corridor where you wake up).
EDIT: Just in case, here's the shader (only the main() function, a simple change).
void main()
{
vec3 vDiffuseColor = texture2DRect(diffuseMap, gl_TexCoord[0].xy).xyz;
// vec3 vOutput = vec3 (texture1D(convMap, vDiffuseColor.x).x,
// texture1D(convMap, vDiffuseColor.y).y,
// texture1D(convMap, vDiffuseColor.z).z);
float outputColor = vDiffuseColor.x + vDiffuseColor.y + vDiffuseColor.z;
outputColor /= 3.0f;
vec3 vOutput = vec3(outputColor, outputColor, outputColor);
@ifdef UseFadeAlpha
gl_FragColor.xyz = vOutput*afFadeAlpha + vDiffuseColor*(1-afFadeAlpha);
@else
gl_FragColor.xyz = vOutput;
@endif
}
Now to figure out if this can be mod-specific...
BTW, I still wouldn't give up on the sepia gradient map - the one I was referring to is located at:
redist\textures\effects\colorconv_sepia.tga