• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_fog_distance
4
5Name Strings
6
7    GL_NV_fog_distance
8
9Contact
10
11    Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com)
12
13Notice
14
15    Copyright NVIDIA Corporation, 1999, 2000, 2001.
16
17IP Status
18
19    NVIDIA Proprietary.
20
21Status
22
23    Shipping (version 1.0)
24
25Version
26
27    NVIDIA Date:   January 18, 2001
28    Version:       1.0
29
30Number
31
32    192
33
34Dependencies
35
36    Written based on the wording of the OpenGL 1.2 specification.
37
38Overview
39
40    Ideally, the fog distance (used to compute the fog factor as
41    described in Section 3.10) should be computed as the per-fragment
42    Euclidean distance to the fragment center from the eye.  In practice,
43    implementations "may choose to approximate the eye-coordinate
44    distance from the eye to each fragment center by abs(ze).  Further,
45    [the fog factor] f need not be computed at each fragment, but may
46    be computed at each vertex and interpolated as other data are."
47
48    This extension provides the application specific control over how
49    OpenGL computes the distance used in computing the fog factor.
50
51    The extension supports three fog distance modes: "eye plane absolute",
52    where the fog distance is the absolute planar distance from the eye
53    plane (i.e., OpenGL's standard implementation allowance as cited above);
54    "eye plane", where the fog distance is the signed planar distance
55    from the eye plane; and "eye radial", where the fog distance is
56    computed as a Euclidean distance.  In the case of the eye radial
57    fog distance mode, the distance may be computed per-vertex and then
58    interpolated per-fragment.
59
60    The intent of this extension is to provide applications with better
61    control over the tradeoff between performance and fog quality.
62    The "eye planar" modes (signed or absolute) are straightforward
63    to implement with good performance, but scenes are consistently
64    under-fogged at the edges of the field of view.  The "eye radial"
65    mode can provide for more accurate fog at the edges of the field of
66    view, but this assumes that either the eye radial fog distance is
67    computed per-fragment, or if the fog distance is computed per-vertex
68    and then interpolated per-fragment, then the scene must be
69    sufficiently tessellated.
70
71Issues
72
73    What should the default state be?
74
75      IMPLEMENTATION DEPENDENT.
76
77      The EYE_PLANE_ABSOLUTE_NV mode is the most consistent with the way
78      most current OpenGL implementations are implemented without this
79      extension, but because this extension provides specific control
80      over a capability that core OpenGL is intentionally lax about,
81      the default fog distance mode is left implementation dependent.
82      We would not want a future OpenGL implementation that supports
83      fast EYE_RADIAL_NV fog distance to be stuck using something less.
84
85      Advice:  If an implementation can provide fast per-pixel EYE_RADIAL_NV
86      support, then EYE_RADIAL_NV is the ideal default, but if not, then
87      EYE_PLANE_ABSOLUTE_NV is the most reasonable default mode.
88
89    How does this extension interact with the EXT_fog_coord extension?
90
91      If FOG_COORDINATE_SOURCE_EXT is set to FOG_COORDINATE_EXT,
92      then the fog distance mode is ignored.  However, the fog
93      distance mode is used when the FOG_COORDINATE_SOURCE_EXT is
94      set to FRAGMENT_DEPTH_EXT.  Essentially, when the EXT_fog_coord
95      functionality is enabled, the fog distance is supplied by the
96      user-supplied fog-coordinate so no automatic fog distance computation
97      is performed.
98
99New Procedures and Functions
100
101    None
102
103New Tokens
104
105    Accepted by the <pname> parameters of Fogf, Fogi, Fogfv, Fogiv,
106    GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev:
107
108        FOG_DISTANCE_MODE_NV               0x855A
109
110    When the <pname> parameter of Fogf, Fogi, Foggv, and Fogiv, is
111    FOG_DISTANCE_MODE_NV, then the value of <param> or the value pointed
112    to by <params> may be:
113
114        EYE_RADIAL_NV                      0x855B
115        EYE_PLANE
116        EYE_PLANE_ABSOLUTE_NV              0x855C
117
118Additions to Chapter 2 of the 1.2 Specification (OpenGL Operation)
119
120     None
121
122Additions to Chapter 3 of the 1.2 Specification (Rasterization)
123
124 --  Section 3.10 "Fog"
125
126    Add to the end of the 3rd paragraph:
127
128    "If pname is FOG_DISTANCE_MODE_NV, then param must be, or params
129    must point to an integer that is one of the symbolic constants
130    EYE_PLANE_ABSOLUTE_NV, EYE_PLANE, or EYE_RADIAL_NV and this symbolic
131    constant determines how the fog distance should be computed."
132
133    Replace the 4th paragraph beginning "An implementation may choose
134    to approximate ..." with:
135
136    "When the fog distance mode is EYE_PLANE_ABSOLUTE_NV, the fog
137    distance z is approximated by abs(ze) [where ze is the Z component
138    of the fragment's eye position].  When the fog distance mode is
139    EYE_PLANE, the fog distance z is approximated by ze.  When the
140    fog distance mode is EYE_RADIAL_NV, the fog distance z is computed
141    as the Euclidean distance from the center of the fragment in eye
142    coordinates to the eye position.  Specifically:
143
144      z  =  sqrt( xe*xe + ye*ye + ze*ze );
145
146    In the EYE_RADIAL_NV fog distance mode, the Euclidean distance
147    is permitted to be computed per-vertex, and then interpolated
148    per-fragment."
149
150    Change the last paragraph to read:
151
152    "The state required for fog consists of a three valued integer to
153    select the fog equation, a three valued integer to select the fog
154    distance mode, three floating-point values d, e, and s, and RGBA fog
155    color and a fog color index, and a single bit to indicate whether
156    or not fog is enabled.  In the initial state, fog is disabled,
157    FOG_MODE is EXP, FOG_DISTANCE_NV is implementation defined, d =
158    1.0, e = 1.0, and s = 0.0; Cf = (0,0,0,0) and if = 0."
159
160Additions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations
161and the Frame Buffer)
162
163    None
164
165Additions to Chapter 5 of the 1.2 Specification (Special Functions)
166
167    None
168
169Additions to Chapter 6 of the 1.2 Specification (State and State Requests)
170
171    None
172
173Additions to the AGL/GLX/WGL Specifications
174
175    None
176
177GLX Protocol
178
179    None
180
181Errors
182
183    INVALID_ENUM is generated when Fog is called with a <pname> of
184    FOG_DISTANCE_MODE_NV and the value of <param> or what is pointed
185    to by <params> is not one of EYE_PLANE_ABSOLUTE_NV, EYE_PLANE,
186    or EYE_RADIAL_NV.
187
188New State
189
190(table 6.8, p198) add the entry:
191
192Get Value              Type    Get Command  Initial Value      Description      Sec     Attribute
193--------------------   ----    -----------  ---------------    -----------      -----   ---------
194FOG_DISTANCE_MODE_NV   Z3      GetIntegerv  implementation     Determines how   3.10    fog
195                                            dependent          fog distance
196                                                               is computed
197
198New Implementation State
199
200    None
201
202Revision History
203
204    None
205