On 09/19/2011 03: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 fragment.)

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 fashion.

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.

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.

Looks pretty good to me, apart from one code formatting issue in 3/5.

I don't know if the old NV drivers are getting much attention but we could probably push those patches anyway.

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to