I worked on this project for the Project Reality mod for Battlefield 2. The Project Reality mod focuses on a heighted sense of realism and immersion and thus has an extremely minimalistic HUD. There is no visible health bar, so the team found it necessary to communicate the player's health via other means. They had discovered a clever trick involving spawning a tiny tear-gas cloud inside the player's collision when his health dropped below a certain threshold, which would trigger the activation of the tear-gas distortion effect built into the base game. However, this effect did not effectively sense that the player was gravely incapacitated and near death. I offered to write a custom shader for the team that might better sync up with the mechanic's theme.
This shader samples a texture created by the engine that captures a half-resolution grab of the framebuffer. It then re-maps the levels of the image via a sigmoid curve, causing the dark and light values to be blown out, greatly increasing the contrast of the scene. The image is then partially desaturated, particularly towards the edges. These two effects were intended to convey the sense that someone suffering from severe blood loss or shock would be less able to distinguish subtle visual differences and how their vision might be easily overwhelmed. A tunnel vision effect, implemented by using min/max functions based on the UV coordinates of the image, was also added to reinforce this sense of blood loss.
Click the links below to see how a sample scene from Forgotten Hope 2 looks like with the shader on and off.
In the video below (taken from a test implentation in a local version of the Forgotten Hope 2 mod,) the player starts off with the effect enabled. It gradually wears off over the last twenty or so seconds, revealing the original level of color and contrast the renderer sees.