In the wiki under "shaders" "Shader hints" there is something about implementing fog in shaders. Worth a try?