[Mesa-dev] Implement NV_fog_distance for Gallium hardware

Corbin Simpson mostawesomedude at gmail.com
Mon Sep 19 09:44:00 PDT 2011


On Mon, Sep 19, 2011 at 5:48 PM, Nicholas Miell <nmiell at gmail.com> 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.

We're not caring so much about r300c and r600c these days.

This all looks good. I can't really ack the Mesa parts, but the logic
seems sound enough.

-- 
When the facts change, I change my mind. What do you do, sir? ~ Keynes

Corbin Simpson
<MostAwesomeDude at gmail.com>


More information about the mesa-dev mailing list