I'm treading into pretty unknown territory right now. But I apparently found a black and white shader. I just have no idea how to apply it for use in the game yet. Still trying, though.
uniform sampler2D tex;
void main() {
vec4 FragColor = texture2D(tex, gl_TexCoord);
gl_FragColor = max(FragColor.r,max(FragColor.g,FragColor.b));
}
Update: Okay, so I believe that "amnesia the dark descent\core\shaders\posteffect_color_conv_tex_frag.glsl" is the sepia shader, based on my inference of the name, and the fact that fiddling with it makes the in-game sepia effect go pitch black (but nothing else). Closer, I guess! Now how to convert this from a sepia tone, to desaturation!
////////////////////////////////////////////////////////
// PostEffect Bloom Blur - Fragment Shader
//
// Blur effect for the bloom post effect
////////////////////////////////////////////////////////
#version 120
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect diffuseMap;
@define sampler_diffuseMap 0
uniform sampler1D convMap;
@define sampler_convMap 1
@ifdef UseFadeAlpha
uniform float afFadeAlpha;
@endif
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);
@ifdef UseFadeAlpha
gl_FragColor.xyz = vOutput*afFadeAlpha + vDiffuseColor*(1-afFadeAlpha);
@else
gl_FragColor.xyz = vOutput;
@endif
}
I'm starting to pick things apart. diffuseMap seems to be what determines the actual color of an object. The problem I'm seeing is that it also appears to be an overlay effect? Which means that it can't be used to desaturate, only adjust hues. I might be wrong in that.
"amnesia the dark descent\textures\effects\colorconv_sepia.tga" definitely plays a role in this. Adjusting the hue led to some odd effects. I changed it to a blue color instead of orange, and things got darker, but lights still remained red in color (torches, etc). Specular effects (shine and the like) seems to be a bright pink, as well.
Commenting out almost any part of the code results in a pitch black screen when the sepia effect is active. Trying to achieve a lack of effect and work from there. So desperately confused.
Update: Starting to identify pieces, I think. Bear in mind that I'm learning blind.
////////////////////////////////////////////////////////
// PostEffect Bloom Blur - Fragment Shader
//
// Blur effect for the bloom post effect
////////////////////////////////////////////////////////
#version 120
// I have no clue what this is.
#extension GL_ARB_texture_rectangle : enable
// Controls color diffusing? I don't know the syntax at all.
uniform sampler2DRect diffuseMap;
@define sampler_diffuseMap 0
// This is really throwing me off. I'm guessing this controls the lighting?
uniform sampler1D convMap;
@define sampler_convMap 1
// Defines fading early on.
@ifdef UseFadeAlpha
uniform float afFadeAlpha;
@endif
// End of initial fading.
// Main effect variables.
void main()
{
// This defines the color used for diffusing on the gradient, I think?
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
);
// End of effect variables.
// Fading in and out.
// Checks to see if the effect is supposed to be only partially visible.
@ifdef UseFadeAlpha
// If it is, it adjusts the alpha accordingly.
gl_FragColor.xyz = vOutput*afFadeAlpha + vDiffuseColor*(1-afFadeAlpha);
@else
// If it is not, then the alpha is 100% visible.
gl_FragColor.xyz = vOutput;
@endif
// End of fading.
}
Stepping away from this for a bit.