15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci NV_fog_distance 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_NV_fog_distance 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNotice 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Copyright NVIDIA Corporation, 1999, 2000, 2001. 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciIP Status 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci NVIDIA Proprietary. 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciStatus 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Shipping (version 1.0) 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ciVersion 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ci NVIDIA Date: January 18, 2001 285bd8deadSopenharmony_ci Version: 1.0 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciNumber 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci 192 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciDependencies 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci Written based on the wording of the OpenGL 1.2 specification. 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ciOverview 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ci Ideally, the fog distance (used to compute the fog factor as 415bd8deadSopenharmony_ci described in Section 3.10) should be computed as the per-fragment 425bd8deadSopenharmony_ci Euclidean distance to the fragment center from the eye. In practice, 435bd8deadSopenharmony_ci implementations "may choose to approximate the eye-coordinate 445bd8deadSopenharmony_ci distance from the eye to each fragment center by abs(ze). Further, 455bd8deadSopenharmony_ci [the fog factor] f need not be computed at each fragment, but may 465bd8deadSopenharmony_ci be computed at each vertex and interpolated as other data are." 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci This extension provides the application specific control over how 495bd8deadSopenharmony_ci OpenGL computes the distance used in computing the fog factor. 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci The extension supports three fog distance modes: "eye plane absolute", 525bd8deadSopenharmony_ci where the fog distance is the absolute planar distance from the eye 535bd8deadSopenharmony_ci plane (i.e., OpenGL's standard implementation allowance as cited above); 545bd8deadSopenharmony_ci "eye plane", where the fog distance is the signed planar distance 555bd8deadSopenharmony_ci from the eye plane; and "eye radial", where the fog distance is 565bd8deadSopenharmony_ci computed as a Euclidean distance. In the case of the eye radial 575bd8deadSopenharmony_ci fog distance mode, the distance may be computed per-vertex and then 585bd8deadSopenharmony_ci interpolated per-fragment. 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci The intent of this extension is to provide applications with better 615bd8deadSopenharmony_ci control over the tradeoff between performance and fog quality. 625bd8deadSopenharmony_ci The "eye planar" modes (signed or absolute) are straightforward 635bd8deadSopenharmony_ci to implement with good performance, but scenes are consistently 645bd8deadSopenharmony_ci under-fogged at the edges of the field of view. The "eye radial" 655bd8deadSopenharmony_ci mode can provide for more accurate fog at the edges of the field of 665bd8deadSopenharmony_ci view, but this assumes that either the eye radial fog distance is 675bd8deadSopenharmony_ci computed per-fragment, or if the fog distance is computed per-vertex 685bd8deadSopenharmony_ci and then interpolated per-fragment, then the scene must be 695bd8deadSopenharmony_ci sufficiently tessellated. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ciIssues 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci What should the default state be? 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci IMPLEMENTATION DEPENDENT. 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci The EYE_PLANE_ABSOLUTE_NV mode is the most consistent with the way 785bd8deadSopenharmony_ci most current OpenGL implementations are implemented without this 795bd8deadSopenharmony_ci extension, but because this extension provides specific control 805bd8deadSopenharmony_ci over a capability that core OpenGL is intentionally lax about, 815bd8deadSopenharmony_ci the default fog distance mode is left implementation dependent. 825bd8deadSopenharmony_ci We would not want a future OpenGL implementation that supports 835bd8deadSopenharmony_ci fast EYE_RADIAL_NV fog distance to be stuck using something less. 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci Advice: If an implementation can provide fast per-pixel EYE_RADIAL_NV 865bd8deadSopenharmony_ci support, then EYE_RADIAL_NV is the ideal default, but if not, then 875bd8deadSopenharmony_ci EYE_PLANE_ABSOLUTE_NV is the most reasonable default mode. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci How does this extension interact with the EXT_fog_coord extension? 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci If FOG_COORDINATE_SOURCE_EXT is set to FOG_COORDINATE_EXT, 925bd8deadSopenharmony_ci then the fog distance mode is ignored. However, the fog 935bd8deadSopenharmony_ci distance mode is used when the FOG_COORDINATE_SOURCE_EXT is 945bd8deadSopenharmony_ci set to FRAGMENT_DEPTH_EXT. Essentially, when the EXT_fog_coord 955bd8deadSopenharmony_ci functionality is enabled, the fog distance is supplied by the 965bd8deadSopenharmony_ci user-supplied fog-coordinate so no automatic fog distance computation 975bd8deadSopenharmony_ci is performed. 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ciNew Procedures and Functions 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci None 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciNew Tokens 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Accepted by the <pname> parameters of Fogf, Fogi, Fogfv, Fogiv, 1065bd8deadSopenharmony_ci GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci FOG_DISTANCE_MODE_NV 0x855A 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci When the <pname> parameter of Fogf, Fogi, Foggv, and Fogiv, is 1115bd8deadSopenharmony_ci FOG_DISTANCE_MODE_NV, then the value of <param> or the value pointed 1125bd8deadSopenharmony_ci to by <params> may be: 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci EYE_RADIAL_NV 0x855B 1155bd8deadSopenharmony_ci EYE_PLANE 1165bd8deadSopenharmony_ci EYE_PLANE_ABSOLUTE_NV 0x855C 1175bd8deadSopenharmony_ci 1185bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci None 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 Specification (Rasterization) 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci -- Section 3.10 "Fog" 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci Add to the end of the 3rd paragraph: 1275bd8deadSopenharmony_ci 1285bd8deadSopenharmony_ci "If pname is FOG_DISTANCE_MODE_NV, then param must be, or params 1295bd8deadSopenharmony_ci must point to an integer that is one of the symbolic constants 1305bd8deadSopenharmony_ci EYE_PLANE_ABSOLUTE_NV, EYE_PLANE, or EYE_RADIAL_NV and this symbolic 1315bd8deadSopenharmony_ci constant determines how the fog distance should be computed." 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci Replace the 4th paragraph beginning "An implementation may choose 1345bd8deadSopenharmony_ci to approximate ..." with: 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci "When the fog distance mode is EYE_PLANE_ABSOLUTE_NV, the fog 1375bd8deadSopenharmony_ci distance z is approximated by abs(ze) [where ze is the Z component 1385bd8deadSopenharmony_ci of the fragment's eye position]. When the fog distance mode is 1395bd8deadSopenharmony_ci EYE_PLANE, the fog distance z is approximated by ze. When the 1405bd8deadSopenharmony_ci fog distance mode is EYE_RADIAL_NV, the fog distance z is computed 1415bd8deadSopenharmony_ci as the Euclidean distance from the center of the fragment in eye 1425bd8deadSopenharmony_ci coordinates to the eye position. Specifically: 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci z = sqrt( xe*xe + ye*ye + ze*ze ); 1455bd8deadSopenharmony_ci 1465bd8deadSopenharmony_ci In the EYE_RADIAL_NV fog distance mode, the Euclidean distance 1475bd8deadSopenharmony_ci is permitted to be computed per-vertex, and then interpolated 1485bd8deadSopenharmony_ci per-fragment." 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci Change the last paragraph to read: 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci "The state required for fog consists of a three valued integer to 1535bd8deadSopenharmony_ci select the fog equation, a three valued integer to select the fog 1545bd8deadSopenharmony_ci distance mode, three floating-point values d, e, and s, and RGBA fog 1555bd8deadSopenharmony_ci color and a fog color index, and a single bit to indicate whether 1565bd8deadSopenharmony_ci or not fog is enabled. In the initial state, fog is disabled, 1575bd8deadSopenharmony_ci FOG_MODE is EXP, FOG_DISTANCE_NV is implementation defined, d = 1585bd8deadSopenharmony_ci 1.0, e = 1.0, and s = 0.0; Cf = (0,0,0,0) and if = 0." 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 1615bd8deadSopenharmony_ciand the Frame Buffer) 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci None 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.2 Specification (Special Functions) 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci None 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.2 Specification (State and State Requests) 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci None 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci None 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ciGLX Protocol 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci None 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ciErrors 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci INVALID_ENUM is generated when Fog is called with a <pname> of 1845bd8deadSopenharmony_ci FOG_DISTANCE_MODE_NV and the value of <param> or what is pointed 1855bd8deadSopenharmony_ci to by <params> is not one of EYE_PLANE_ABSOLUTE_NV, EYE_PLANE, 1865bd8deadSopenharmony_ci or EYE_RADIAL_NV. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ciNew State 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci(table 6.8, p198) add the entry: 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ciGet Value Type Get Command Initial Value Description Sec Attribute 1935bd8deadSopenharmony_ci-------------------- ---- ----------- --------------- ----------- ----- --------- 1945bd8deadSopenharmony_ciFOG_DISTANCE_MODE_NV Z3 GetIntegerv implementation Determines how 3.10 fog 1955bd8deadSopenharmony_ci dependent fog distance 1965bd8deadSopenharmony_ci is computed 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ciNew Implementation State 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci None 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ciRevision History 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci None 205