[Mesa-dev] Implement NV_fog_distance for Gallium hardware
idr at freedesktop.org
Mon Sep 19 10:23:29 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
On 09/19/2011 02:48 AM, Nicholas Miell wrote:
> The NV_fog_distance extension allows you to specify how the fog
> distance of a fragment is calculated. The usual method approximates
> the distance of the fragment from the eye as the absolute value of
> the distance of the fragment from the eye's Z plane. (Or, rather,
> the distance of each vertex and then interpolated for each
> NV_fog_distance introduces the eye radial fog distance mode, which
> calculates the actual distance from the eye to the vertex. Using
> the actual distance avoids weird peripheral vision artifacts where
> the rotation of eye causes previously invisible portions of the
> scene to suddenly fade into visibility in a strange and unnatural
It might also be worth testing it in Wolfenstein: Enemy Territory. I
recall several user created maps that had horrible fog artifacts like
this. You could see enemies approaching across the battlefield, but
only if you weren't looking directly at them...
> Direct3D 9 calls the eye radial fog distance mode "range-based fog"
> and Wine's D3D9 implementation will use NV_fog_distance to
> implement it. Several other open source game engines in Google Code
> Search use the eye radial fog mode if it is available.
I guess the big question is... why? With vertex shaders, this
functionality is not terribly useful. Over the past few weeks we've
been *removing* code like this, so it seems kind of odd to add some of
it. If I'm not mistaken, the only hardware in Mesa that can do this
but not vertex shaders is NV10. Is it really that helpful?
I'm not necessarily opposed to adding this, I just want to be sure
we're giving it full thought... that's all.
> This has been tested with the R600 Gallium driver in Minecraft
> (with the OptiFine mod). Extensively.
> I also threw in an untested implementation for NV10 and NV20 GPUs.
> It looked rather obvious based on the register and constant names
> and the assumption that since NVIDIA wrote the extesion, their
> hardware does the right thing. However, I have no way to test this
> so it is best left unapplied until somebody who can test it does
> test it.
> In theory this should be easy to add to the non-Gallium drivers for
> the i965 and r600 and perhaps more difficult to add to the
> non-Gallium r300 driver (r300 appears to still implement fog in
> hardware), but I personally don't care.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the mesa-dev