LeiFX - an approximation of a infamous screen filter
This web page is dedicated to the development of an
experimental shader to recreate the 4x1 linear filter of the once
ubiquitous 3dfx Voodoo Graphics and Voodoo2 3d accellerators. Their
internal filters are intended to approximate a 24-bit image by
filtering a 16-bit image in the buffer (which itself was dithered
down from a 24-bit source). This shader aims to recreate that
effect. This filter is usually tied with a lot of nostalgia for
the early 3dfx accelerators mostly because comparably with other cards
of the time, it's much brighter and distinctively blurry. The
common complaint about an nVidia card back then (Riva128 & TNT
series) and a game such as GLQuake or Quake2 is that it is dark - this
is because of the common exposure of 3dfx's default gamma via their
is my first post-process shader while learning HLSL / cg. I
probably most likely typed in some facepalm-quality stuff in the
shader. I did it because I haven't seen it done, and I wanted to
stop waiting for one to exist.
Currently, the shader is available for the SweetFX +
eFX bundle in a prototype form. It requires a DX9-supporting
video card with support for Pixel Shader 3.0.
The shader code is licensed under the GNU General Public License version 2.
|Shader disabled||Shader enabled|
A slashed up picture ( ( Y )
cleavage warning, to skip click here
How does my shader work
|Pass 1||Apply dots of slightly alternating gamma to fake dither.|
Reduce the color depth to 16bpp.
Increase the color depth back to 24bpp.
|Pass 2||Apply gamma of 1.3 for even lines and 1.2 for odd lines|
|Pass 3||Filter a pixel to the right determined by mean|
Installing onto SweetFX 1.5.1 Please don't contact me asking about how to install this! You can find SweetFX somewhere in here.
Tips when using:
- Download and save leifx_filter.h and leifx_reduct.h into your SweetFX/Shaders/ folder
- If you didn't modify SweetFX_D3D9.fx, or isn't a version after 2013-11-09, you can replace it with that one too.
- If you didn't modify Main.h for other shaders you can also download that.
- Edit SweetFX_Settings.txt and add the following lines after #define USE_CUSTOM 0
|#define USE_LEIFX_REDUCT 1 //[0 or 1] Reduce to 16bpp with dither|
#define USE_LEIFX_FILTER 1 //[0 or 1] Filter the image
- Ran you're game, !!?
- For Glide wrappers, i've had best luck with psVoodoo, however mipmaps are not used so the distanced blur effect will be missing.
- For OpenGL-to-D3D9 wrappers, i've had best luck with Scitech GLDirect 5's 2007 open source binary on Sourceforge.net
- Unreal Tournament with UTGLR D3D9 is a nice choice.
- Try to use 16-bit textures when you can. In id tech 3 (Quake III Arena, Alice, etc) just simply r_textureBits 16.
to take texture detail down a notch if it allows you to, in newer games
2000 or later. 3dfx cards have a maximum supported texture size of
256x256. In id tech 3 (Quake III Arena, Alice, etc) r_picmip 1 is
usually the best default for a Voodoo2 12MB (as r_picmip 0 would cause
- Always try to use 32-bit color when you can.
Although the shader DOES WORK IN 16-BIT COLOR (with psuedo-dither even,
a thing modern video hardware doesn't implement anymore), the 4x1
filter is most effective in 32bpp. 3dfx did that on DAC so it wasn't
really possible to rip the filtered image right off their internal
16bpp buffer. VGA capture hardware (such as VGA2USB) can pull this off
This shader is far from perfect. It is only an approximation of what those video cards once did. It's not
the exact process and algorithm they used. I didn't extensively
reverse engineer the cards or even use VGA capturing for analysis.
- it is completely wrong in this shader. 3dfx employed an ordered
dither to the image. My shader currently fakes a dither by some fake
dots stupidly placed on screen.
- this is a SIX pass shader. This may be unavoidable due to the
linear filter's nature to filter upon itself (in theory). I
have done a one pass shader for it before, but it looked very
artificial and didn't capture the blur properly.
- It's not GLSL
- well if anyone would like to go for some sort of nice GL wrapper that
does this shader or even better implement it in some open sourced Glide
wrapper...... go right ahead!
- Gamma - Not sure where gamma is applied. Usually in most games 3dfx does a gamma of 1.3 by default (and 1.7 in some early cases). I currently do the 'lines' in the gamma pass and I apply it BEFORE the 4x1 filter.
- Too specialized - Right now, the shader is for a particular D3D9 injector that is only popular for improving image quality in modern
games. This is way too strict and closed for general usage in my
opinion (i.e. relying on other wrappers to go D3D9 to see it in older
games). I'd love to see it in Dolphin, RetroArch, glide wrappers, ioquake3, R1Q2, DXGL, WineD3D, etc....
- Limited in function
- it is only a post-process filter. It does not have the ability to
dither blend functions (so no green/purple smoke). An advanced
shader-happy Glide wrapper would be needed to do that.....