1Name 2 3 ARB_point_parameters 4 5Name Strings 6 7 GL_ARB_point_parameters 8 9Contact 10 11 Michael Gold, NVIDIA (gold 'at' nvidia.com) 12 13Notice 14 15 Copyright (c) 2000-2013 The Khronos Group Inc. Copyright terms at 16 http://www.khronos.org/registry/speccopyright.html 17 18Status 19 20 Approved by the ARB, 21 June 2000. 21 22Version 23 24 Revision Date: September 23, 2010 25 Version: 0.6 26 27 Based on: EXT_point_parameters 28 $Date: 1997/08/21 21:26:36 $ $Revision: 1.6 $ 29 30Number 31 32 ARB Extension #14 33 34Dependencies 35 36 OpenGL 1.0 is required. 37 ARB_multisample affects the definition of this extension. 38 The extension is written against the OpenGL 1.2.1 Specification. 39 40Overview 41 42 This extension supports additional geometric characteristics of 43 points. It can be used to render particles or tiny light sources, 44 commonly referred to as "Light points". 45 46 The raster brightness of a point is a function of the point area, 47 point color, point transparency, and the response of the display's 48 electron gun and phosphor. The point area and the point transparency 49 are derived from the point size, currently provided with the <size> 50 parameter of glPointSize. 51 52 The primary motivation is to allow the size of a point to be 53 affected by distance attenuation. When distance attenuation has an 54 effect, the final point size decreases as the distance of the point 55 from the eye increases. 56 57 The secondary motivation is a mean to control the mapping from the 58 point size to the raster point area and point transparency. This is 59 done in order to increase the dynamic range of the raster brightness 60 of points. In other words, the alpha component of a point may be 61 decreased (and its transparency increased) as its area shrinks below 62 a defined threshold. 63 64 This extension defines a derived point size to be closely related to 65 point brightness. The brightness of a point is given by: 66 67 1 68 dist_atten(d) = ------------------- 69 a + b * d + c * d^2 70 71 brightness(Pe) = Brightness * dist_atten(|Pe|) 72 73 where 'Pe' is the point in eye coordinates, and 'Brightness' is some 74 initial value proportional to the square of the size provided with 75 PointSize. Here we simplify the raster brightness to be a function 76 of the rasterized point area and point transparency. 77 78 brightness(Pe) brightness(Pe) >= Threshold_Area 79 area(Pe) = 80 Threshold_Area Otherwise 81 82 factor(Pe) = brightness(Pe)/Threshold_Area 83 84 alpha(Pe) = Alpha * factor(Pe) 85 86 where 'Alpha' comes with the point color (possibly modified by 87 lighting). 88 89 'Threshold_Area' above is in area units. Thus, it is proportional to 90 the square of the threshold provided by the programmer through this 91 extension. 92 93 The new point size derivation method applies to all points, while 94 the threshold applies to multisample points only. 95 96IP Status 97 98 None. 99 100Issues 101 102 * Does point alpha modification affect the current color ? 103 104 No. 105 106 * Do we need a special function GetPointParameterfvARB, or get by 107 with GetFloat ? 108 109 GetFloat is sufficient. 110 111 * If alpha is 0, then we could toss the point before it reaches the 112 fragment stage. 113 114 No. This can be achieved with enabling the alpha test with 115 reference of 0 and function of LEQUAL. 116 117 * Do we need a disable for applying the threshold ? The default 118 threshold value is 1.0. It is applied even if the point size is 119 constant. 120 121 If the default threshold is not overridden, the area of 122 multisample points with provided constant size of less than 1.0, 123 is mapped to 1.0, while the alpha component is modulated 124 accordingly, to compensate for the larger area. For multisample 125 points this is not a problem, as there are no relevant 126 applications yet. As mentioned above, the threshold does not apply 127 to alias or antialias points. 128 129 The alternative is to have a disable of threshold application, and 130 state that threshold (if not disabled) applies to non antialias 131 points only (that is, alias and multisample points). 132 133 The behavior without an enable/disable looks fine. 134 135 * Future extensions (to the extension) 136 137 1. POINT_FADE_ALPHA_CLAMP_ARB 138 139 When the derived point size is larger than the threshold size 140 defined by the POINT_FADE_THRESHOLD_SIZE_ARB parameter, it might 141 be desired to clamp the computed alpha to a minimum value, in 142 order to keep the point visible. In this case the formula below 143 change: 144 145 factor = (derived_size/threshold)^2 146 147 factor clamp <= factor 148 clamped_value = 149 clamp factor < clamp 150 151 1.0 derived_size >= threshold 152 alpha *= 153 clamped_value Otherwise 154 155 where clamp is defined by the POINT_FADE_ALPHA_CLAMP_ARB new 156 parameter. 157 158New Procedures and Functions 159 160 void PointParameterfARB(enum pname, 161 float param); 162 void PointParameterfvARB(enum pname, 163 const float *params); 164 165New Tokens 166 167 Accepted by the <pname> parameter of PointParameterfARB, and the 168 <pname> of Get: 169 170 POINT_SIZE_MIN_ARB 171 POINT_SIZE_MAX_ARB 172 POINT_FADE_THRESHOLD_SIZE_ARB 173 174 Accepted by the <pname> parameter of PointParameterfvARB, and the 175 <pname> of Get: 176 177 POINT_SIZE_MIN_ARB 0x8126 178 POINT_SIZE_MAX_ARB 0x8127 179 POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 180 POINT_DISTANCE_ATTENUATION_ARB 0x8129 181 182Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) 183 184 None 185 186Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 187 188 In section 3.3, the following is inserted after the description of 189 PointSize: 190 191 The point size is multiplied with a distance attenuation factor 192 and clamped as follows: 193 194 derived_size = Clamp(size * sqrt(dist_atten(dist))) 195 196 where dist_atten is specified as 197 198 1 199 dist_atten(d) = ------------------- 200 a + b * d + c * d^2 201 202 and 'd' is the eye-coordinate distance from the eye, (0, 0, 0, 1) in 203 eye coordinates, to the vertex. 204 205 The derived point size is clamped to a given range, and then 206 clamped to the implementation-dependent point size range. 207 208 If multisampling is enabled, an implementation may optionally fade 209 the point alpha (section 3.12) instead of allowing the size to go 210 below a given threshold. In this case, the diameter of the 211 rasterized point is 212 213 derived_size derived_size >= threshold 214 diameter = 215 threshold Otherwise 216 217 and the fade factor is computed as follows: 218 219 1 derived_size >= threshold 220 fade = 221 (derived_size/threshold)^2 Otherwise 222 223 The distance attenuation function coefficients, 'a', 'b', and 'c', 224 the bounds of the clamp, and the point fade 'threshold', are 225 specified with 226 227 void PointParameterfARB( enum pname, float param ); 228 void PointParameterfvARB( enum pname, const float *params ); 229 230 If <pname> is POINT_SIZE_MIN_ARB or POINT_SIZE_MAX_ARB, then 231 <param> specifies, or <params> points to the lower or upper bound 232 respectively on the derived point size. If the lower bound is 233 greater than the upper bound, the resulting point size is 234 undefined. If <pname> is POINT_DISTANCE_ATTENUATION_ARB, then 235 <params> points to the coefficients 'a', 'b', and 'c'. If <pname> 236 is POINT_FADE_THRESHOLD_SIZE_ARB, <param> specifies, or <params> 237 points to the point fade threshold. 238 239 This extension doesn't change the feedback or selection behavior of 240 points. 241 242 In section 3.11, the word "Finally" is removed from the first 243 sentence. 244 245 Add the following after section 3.11. 246 247 Section 3.12 Multisample Point Fade 248 249 If multisampling is enabled and the rasterized fragment results 250 from a point primitive, then the computed fade factor is applied 251 to the fragment. In RGBA mode, the fade factor is multiplied by 252 the fragment's alpha (A) value to yield a final alpha value. In 253 color index mode, the fade factor has no effect. 254 255Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment 256Operations and the Frame Buffer) 257 258 None 259 260Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) 261 262 None 263 264Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and 265State Requests) 266 267 None 268 269Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance) 270 271 None 272 273Additions to the GLX / WGL / AGL Specifications 274 275 None 276 277GLX Protocol 278 279 Two new GL rendering commands are added. The following commands are 280 sent to the server as part of a glXRender request: 281 282 PointParameterfARB 283 2 8+4*n rendering command length 284 2 2065 rendering command opcode 285 4 ENUM pname 286 0x8126 n=1 POINT_SIZE_MIN_ARB 287 0x8127 n=1 POINT_SIZE_MAX_ARB 288 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_ARB 289 4 FLOAT32 param 290 291 PointParameterfvARB 292 2 8+4*n rendering command length 293 2 2066 rendering command opcode 294 4 ENUM pname 295 0x8126 n=1 POINT_SIZE_MIN_ARB 296 0x8127 n=1 POINT_SIZE_MAX_ARB 297 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_ARB 298 0x8129 n=3 POINT_DISTANCE_ATTENUATION_ARB 299 4*n LISTofFLOAT32 params 300 301Dependencies on ARB_multisample 302 303 If ARB_multisample is not implemented, then the references to 304 multisample points are invalid, and should be ignored. 305 306Errors 307 308 INVALID_ENUM is generated if PointParameterfARB parameter <pname> is 309 not POINT_SIZE_MIN_ARB, POINT_SIZE_MAX_ARB, or 310 POINT_FADE_THRESHOLD_SIZE_ARB. 311 312 INVALID_ENUM is generated if PointParameterfvARB parameter <pname> 313 is not POINT_SIZE_MIN_ARB, POINT_SIZE_MAX_ARB, 314 POINT_FADE_THRESHOLD_SIZE_ARB, or POINT_DISTANCE_ATTENUATION_ARB 315 316 INVALID_VALUE is generated when values are out of range according 317 to: 318 319 <pname> valid range 320 -------- ----------- 321 POINT_SIZE_MIN_ARB >= 0 322 POINT_SIZE_MAX_ARB >= 0 323 POINT_FADE_THRESHOLD_SIZE_ARB >= 0 324 325 326New State 327 328(table 6.11, p. 201) 329 Initial 330 Get Value Type Get Command Value Description Sec. Attribute 331 --------- ---- ----------- ------- ----------- ---- --------- 332 POINT_SIZE_MIN_ARB R+ GetFloatv 0.0 Attenuated 3.3 point 333 Min point 334 size 335 336 POINT_SIZE_MAX_ARB R+ GetFloatv M Attenuated 3.3 point 337 Max point 338 size 339 340 POINT_FADE_THRESHOLD_SIZE_ARB R+ GetFloatv 1.0 Threshold 3.3 point 341 for alpha 342 attenuation 343 344 POINT_DISTANCE_ATTENUATION_ARB 3xR GetFloatv (1.0,0.0,0.0) 3.3 point 345 Attenuation 346 coefficients 347 348 M is the larger of the max antialiased and non antialiased point 349 sizes. 350 351New Implementation Dependent State 352 353 None 354 355Revision History 356 357 11/09/1999 0.1 358 - First ARB draft based on the original SGI and EXT drafts. 359 360 12/07/1999 0.2 361 - clarified behavior when POINT_SIZE_MIN exceeds POINT_SIZE_MAX 362 - clarified when the point size is clamped to the supported range 363 - removed issues from "Errors" section 364 - fixed various typos 365 - Updated to new extension template 366 - added GLX protocol 367 368 04/20/2000 0.3 369 - rewritten to fit within the context of the 1.2 specification 370 - added language describing where the fade alpha is applied. 371 - added language which indicates that some implementations may not 372 implement POINT_FADE_THRESHOLD_SIZE_ARB 373 374 06/20/2000 0.4 375 - removed alternate behavior for fade alpha, since it is optional 376 - added new section describing fade alpha application 377 378 03/12/2002 0.5 379 - added GLX protocol for PointParameterfARB and assigned ropcodes 380 381 09/23/2010 0.6 (pbrown) 382 - add "const" qualifier to <params> argument to PointParameterfvARB 383