1XXX - Not complete yet!!! 2Name 3 4 SGIX_fog_layers 5 6Name Strings 7 8 GL_SGIX_fog_layers 9 10Version 11 12 $Date: 1999/03/30 23:13:43 $ $Revision: 1.14 $ 13 14Number 15 16 ?? 17 18Dependencies 19 20 OpenGL 1.2 is required 21 22Overview 23 24 This extension adds support for layered fog. The layers are 25 specified using a density profile of the fog with respect to the 26 elevation using "control" points to represent (elevation, density) 27 tuples. The density is assumed to vary linearly between successive 28 control point elevations. The maximum number of such points is 29 implementation dependent. 30 31 32New Procedures and Functions 33 34 void FogLayersSGIX(sizei n, const float *points); 35 36 void GetFogLayersSGIX(float *points); 37 38Issues 39 40 * Should the API present the abstraction of layers to the user ? Or 41 is this density profile specification good enough ? The problem 42 with abstracting layers is to guarantee consistency of densities 43 and elevations when each layer can be manipulated independently of 44 others! 45 46New Tokens 47 48 Accepted by the <pname> parameter of Fogf, Fogi, Fogiv, Fogfv, 49 GetBooleanv, GetDoublev, GetIntegerv, and GetFloatv: 50 51 FOG_TYPE_SGIX 0x8323 52 53 Accepted by the <param> parameter of Fogf and Fogi, and by the 54 <params> parameter of Fogiv and Fogfv, when their <pname> 55 parameter is FOG_TYPE_SGIX: 56 57 UNIFORM_SGIX 0x8324 58 LAYERED_SGIX 0x8325 59 60 Accepted by the <pname> parameter of Fogfv, Fogiv, GetBooleanv, 61 GetDoublev, GetIntegerv, and GetFloatv: 62 63 FOG_GROUND_PLANE_SGIX 0x8326 64 65 Accepted by the <pname> parameter of GetBooleanv, GetDoublev, 66 GetIntegerv, and GetFloatv: 67 68 FOG_LAYERS_POINTS_SGIX 0x8327 69 MAX_FOG_LAYERS_POINTS_SGIX 0x8328 70 71Additions to Chapter 2 of the 1.2 Specification (OpenGL Operation) 72 73 None 74 75Additions to Chapter 3 of the 1.2 Specification (Rasterization) 76 77 3.10 Fog 78 79 In addition to uniform fog density, fog layers can be specified. 80 The implementation technique that is used to interpolate the 81 density between successive fog layers is implementation dependent. 82 The density profile of the fog with respect to elevation is 83 specified by calling FogLayersSGIX with <points> 84 pointing at an array of pairs of floating point values, and <n> set 85 to the number of value pairs in <points>. The first value of each 86 value pair in <points> specifies the elevation (should not be 87 negative), and the second value specifies the fog density at that 88 elevation. The fog density values are clamped to the range [0.0, 89 1.0]. The elevations in the specification of the density profile 90 must be monotonically increasing. At least one point must be 91 specified. The first point in the distribution must have an 92 elevation of zero. The maximum number of points is implementation 93 dependent and may be enquired using Get commands. The initial 94 state of the fog layer specification is defined by the single 95 point (0.0, 0.0). The fog density above the maximum user-specified 96 elevation is the density value in the last point in the profile. 97 Layered fog computations are defined only for positive elevations; 98 negative elevations result in switching back to uniform range fog model. 99 100 The elevation of any eye-space point A = (x, y, z, w) is defined 101 as the distance from the ground plane specified using glFog and 102 FOG_GROUND_PLANE_SGIX. Let the ground plane be defined by a 103 four-component plane equation in object-coordinates 104 105 G = (a, b, c, d). 106 107 where a, b, c and d are specified in order in the <params> 108 argument for Fogfv or Fogiv. 109 110 The ground plane is transformed into eye-coordinate space usi 111 the inverse transpose of the model-view matrix. Then the elevation 112 of point A (in eye-coordinate space) is the dot product A . G' 113 (G' - ground plane in eye-coordinate space): 114 115 elevation = a*x + b*y + c*z + d*w 116 117 Since the eye-point is defined to be at (0,0,0,1) in camera-space, 118 the elevation of the eye-point is the same as 'd' (the fourth 119 component of the ground plane). 120 121 122 ___________ 123 | | S |\ 124 elevation --| Layered |-----| \ _____ 125 | Fog | | \ | | To fog equation 126 |_________| | |_____| * |------- 127 | | __| | (r*S) 128 | / | |_____| 129 uniform density ---| / | 130 |/ | 131 | 132 range _______________| 133 134 135 136 The effective density 'S' from the eye-point is computed for every 137 fragment using the fog layer specification (XXX: how?). This 138 density is used in the fog equation to compute the fog blending 139 factor 'f' depending on the selected FOG_MODE. 140 141 142Additions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 143and the Frame Buffer) 144 145 None 146 147Additions to Chapter 5 of the 1.2 Specification (Special Functions) 148 149 None 150 151Additions to Chapter 6 of the 1.2 Specification (State and State Requests) 152 153 The max allowed number of points in the fog layer specification 154 is queried by calling GetBooleanv, GetIntegerv, GetFloatv, and 155 GetDoublev with <pname> set to MAX_FOG_LAYERS_POINTS_SGIX. The 156 number of points in the current fog layers specification is queried 157 by calling GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev with 158 <pname> set to FOG_LAYERS_POINTS_SGIX. All the points of the 159 current fog layer specification are queried by calling 160 GetFogLayersSGIX. Points are returned in the same format as they 161 are specified in the FogLayersSGIX function. 162 163Additions to the GLX Specification 164 165 None 166 167Errors 168 169 INVALID_VALUE is generated if FogLayersSGIX parameter <n> is 170 less than 1. 171 172 INVALID_VALUE is generated if any elevation is less than zero. 173 174 INVALID_OPERATION is generated if FogLayersSGIX is executed 175 between execution of Begin and the corresponding execution to 176 End. 177 178 INVALID_OPERATION is generated if GetFogLayersSGIX is executed 179 between execution of Begin and the corresponding execution to 180 End. 181 182New State 183 184 Get Value Get Command Type Initial Value Attribute 185 --------- ----------- ---- ------------- --------- 186 MAX_FOG_LAYERS_POINTS_SGIX GetIntegerv Z+ XXX 187 FOG_LAYERS_POINTS_SGIX GetIntegerv Z+ 1 fog 188 FOG_GROUND_PLANE_SGIX GetFloatv V (0,0,0,0) fog 189 FOG_TYPE_SGIX GetIntegerv Z+ UNIFORM_SGIX fog 190 191 192New Implementation Dependent State 193 194 None 195