This matches values from a PSP exactly, with the help of immediate mode vertex values (since this directly allows specifying the fog factor without any floating point math.)