Download exposure.zip (30KB - contains exposure.dll and exposure.html)
When objects are rendered in 3D, lighting is often calculated by taking a sum of the light striking a surface, then modulating that by the surface color and the cosine of the angle between the surface and the light (so that direct light is "brighter" than indirect light). The result is a mathematically accurate value (relatively accurate, at least) representing the amount of light at any individual pixel.
One problem with this method is that we are accustomed to seeing video recorded on a digital CCD or CMOS sensor or physical film. Recording technologies such as these react to light along what is called a response curve.
The exposure function takes pixel values representing the amount of light and maps them to a response curve.
pixel brightness = e-amount of light
But of course, what we know about cameras is that if you expose the film for a longer amount of time, the camera will collect more light. Expose the film for less time and the camera will collect less light. To add this to the exposure function, we multiply the amount of time by the amount of light being reflected off the surface.
pixel brightness = e-(amount of light ยท exposure time)
In this case, exposure time is actually a percentage of the original simulated exposure time - but since realtime videogames aren't calibrated to real-world light values, it's all a bit of guess-work.
Major caveat: Modern realtime videogames almost universally use HDR values to calculate lighting, then use an exposure function to map those values to clamped pixel brightnesses. Using this filter on games that use HDR lighting will result in overly-harsh images akin to pointing a camera at a TV.
This AviSynth 2.5 plugin provides functions related to the ExposureFunction. The following functions work for RGB24 clips only. Use ConvertToRGB24(clip) for videos in RGB32 or YUV.
Applies the Exposure Function to the image in a "dumb" manner.
Evaluates the image and selects an exposure adjustment value automatically.
The AutoExposure function is actually fast enough to use in realtime (although if you do so you may want to increase the interval to 30). Combined with a video capture card and ffdshow, you can use it to infuse some new life into your last-generation games.
Split-screen video: AutoExposure on the left, original video on the right.
Example of the AutoExposure function - notice that the exposure function brightens the image when the camera zooms in tightly on the black car.
Example of the AutoExposure function - in this clip the exposure function compensates for the differences between darkened tunnels and direct sunlight.
One lap from the Motegi video above, but with additional filtering to add motion blur. In order: AutoExposure on interlaced video; Donald Graft's Smart Bob filter for VirtualDub to get up to 60fps; MSU Frame Rate Conversion filter to bump up to 240fps; AviSynth Merge to take each group of 8 frames and create one motion blurred frame.
A 2-lap race around El Capitan with the Aston Martin Vanquish. Be kind - this is only my 2nd time out in this car!
One lap time-trial around Nurburgring Nordschleife. This is quite the experience in the Elise, a lightweight car that bounces around on this bumpy road. I'm proud of the fact that I really only lost control once.