Framework 4 (Last updated: October 25, 2019)Framework 3 (Last updated: February 6, 2017)Framework 2 (Last updated: October 8, 2006)Framework (Last updated: October 8, 2006)Libraries (Last updated: September 16, 2004)Really old framework (Last updated: September 16, 2004)
Dither
Wednesday, September 25, 2002 | Permalink
Executable
Source code
Dither.zip (441 KB)
Required:GL_ATI_fragment_shader or GL_NV_register_combiners
GL_ARB_texture_env_dot3
GL_EXT_texture3D
GL_EXT_texture_edge_clamp
WGL_ARB_render_texture/GLX_ATI_render_textureThis gotta be the first implementation of 1-bit perpixel lighting. Quite cool, but pretty useless
.
What I have done is to render the scene into a texture, then I do some fake dithering to create a monocrome image which will looks somewhat decent for being monocrome. Real dithering will take neighbouring pixels into account, however, that's a little too much for realtime rendering, but there are tricks you can do to fake it. Tom Nuydens at
Delphi3D has done some
previous work in this area. Tom uses a dither pattern he replicates over the whole framebuffer in the alpha channel, then he does a dependent texture read to solve a expression of (red + alpha > 0.5)? 1 : 0. This works, but the pattern is easy to spot as shown in
the screenshot on his page.
A better way (the way I do it
) is to create a texture containing random offsets of the full size of the rendered texture. The randomness can be tweaked until it looks nice. The random values are added to the rendered values and checked for > 0.5, and either a black or white pixel is outputted. No dependent texture read neccesary.
Thanks to Basic for the idea, certainly better than my previous implementation.
Will run on Radeon 8500/GF3 and up.