• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    ARB_shadow_ambient
4
5Name Strings
6
7    GL_ARB_shadow_ambient
8
9Contact
10
11    Brian Paul (brian_e_paul 'at' yahoo.com)
12
13Notice
14
15    Copyright (c) 2002-2013 The Khronos Group Inc. Copyright terms at
16        http://www.khronos.org/registry/speccopyright.html
17
18Specification Update Policy
19
20    Khronos-approved extension specifications are updated in response to
21    issues and bugs prioritized by the Khronos OpenGL Working Group. For
22    extensions which have been promoted to a core Specification, fixes will
23    first appear in the latest version of that core Specification, and will
24    eventually be backported to the extension document. This policy is
25    described in more detail at
26        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
27
28Status
29
30    Complete. Approved by ARB on February 14, 2002.
31
32Version
33
34    Last Modified Date: 12 December 2001
35
36Number
37
38    ARB Extension #24
39
40Dependencies
41
42    OpenGL 1.1 is required.
43    ARB_shadow is required.
44    ARB_depth_texture is required.
45    This extension is written against the OpenGL 1.3 Specification.
46
47Overview
48
49    This is based on the GL_SGIX_shadow_ambient extension and is layered
50    upon the GL_ARB_shadow extension.
51
52    Basically, this extension allows the user to specify the texture
53    value to use when the texture compare function fails.  Normally
54    this value is zero.  By allowing an arbitrary value we can get
55    functionality which otherwise requires an advanced texture
56    combine extension (such as GL_NV_register_combiners) and multiple
57    texture units.
58
59IP Status
60
61    None.
62
63Issues
64
65    (1) How is this extension different from GL_SGIX_shadow_ambient?
66
67      It's functionally identical.  Since the original spec isn't in
68      the extension registry this one was written from scratch.
69
70    (2) Is this extension really needed?
71
72      RESOLUTION: Yes, if an advanced texture combine extension is not
73      available.  From Mark Kilgard's GDC presentation on shadow mapping:
74
75      The desired color for a lit, textured, shadow fragment is:
76
77      ( ambient + diffuseShade * diffuse) * decal + specular * shade
78
79      where diffuseShade = dimming + ( 1.0 - dimming ) * shade, and
80      shade is the result of the shadow test in [0,1].  dimming
81      expresses the scattered light in a scene.
82
83      If we limit shade to the range [<dimming>, 1] (where <dimming> is
84      TEXTURE_FAIL_VALUE_ARB) then we can express the diffuse term with
85      the standard GL_MODULATE texture env mode.
86
87      Furthermore, this extension allows implementing shadow arithmetic
88      with a single texture stage.  Otherwise, two texture stages are
89      needed in order to compute diffuseShade * diffuse * decal.
90
91      This extension is also useful for implementing shadowed lighting
92      expressions other than the one above.  In particular, a "poor-man's"
93      shadow mode can be implemented by setting TEXTURE_FAIL_VALUE_ARB to
94      the scene's ambient intensity and the texture environment mode to
95      GL_MODULATE.  This is the intention of the original
96      GL_SGIX_shadow_ambient extension.
97
98    (3) What are the downsides of this extension?
99
100      This extension places some arithmetic in the texture sampling logic
101      which would otherwise be better implemented in the texture combine
102      logic.
103
104      Also, there probably aren't many (if any) other uses for this logic
105      other than shadow ambient term.
106
107      Those who already implement advanced texture combine modes probably
108      won't want to implement this extension.
109
110    (4) What should the "shadow ambient" variable be named:
111
112      RESOLUTION: TEXTURE_COMPARE_FAIL_VALUE_ARB since this extension
113      specifies the value used when the texture comparison function fails.
114
115    (5) Is GL_ARB_shadow_ambient a good name for this extension?
116
117      RESOLUTION:  Probably.  Even though this extension is phrased in
118      general terms, it's going to be used almost exclusively for shadow
119      mapping applications.
120
121    (6) Should TEXTURE_COMPARE_FAIL_VALUE_ARB be an alias for
122      GL_SHADOW_AMBIENT_SGIX (from GL_SGIX_shadow_ambient)?
123
124      RESOLUTION: Yes.  It serves the same purpose and avoids adding
125      yet more state to texture objects.
126
127New Procedures and Functions
128
129    None
130
131New Tokens
132
133    Accepted by the <pname> parameter of TexParameterf, TexParameteri,
134    TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv:
135
136    TEXTURE_COMPARE_FAIL_VALUE_ARB  0x80BF  (same as SHADOW_AMBIENT_SGIX)
137
138Additions to Chapter 2 of the 1.3 Specification (OpenGL Operation)
139
140    None
141
142Additions to Chapter 3 of the 1.3 Specification (Rasterization)
143
144    Section 3.8.4, Texture Parameters, p. 133, append table 3.19 with the
145    following:
146
147        Name                            Type   Legal Values
148        ------------------------------  -----  --------------------
149        TEXTURE_COMPARE_FAIL_VALUE_ARB  float   any value in [0, 1]
150
151    Section 3.8.4, Texture Parameters, append last paragraph with:
152
153        "The value set by TEXTURE_COMPARE_FAIL_VALUE_ARB is clamped to
154        lie in [0, 1]."
155
156    Modify section 3.8.13.1, defined in the GL_ARB_shadow specification,
157    as follows:
158
159        "3.8.13.1 Depth Texture Comparison Mode
160
161        [...]
162        else if TEXTURE_COMPARE_MODE_ARB = COMPARE_R_TO_TEXTURE_ARB
163
164            if TEXTURE_COMPARE_FUNC_ARB = LEQUAL
165
166                     { 1.0,                             if R <= Dt
167                 r = {
168                     { TEXTURE_COMPARE_FAIL_VALUE_ARB,  if R > Dt
169
170            else, if TEXTURE_COMPARE_FUNC_ARB = GEQUAL
171
172                     { 1.0,                             if R >= Dt
173                 r = {
174                     { TEXTURE_COMPARE_FAIL_VALUE_ARB,  if R < Dt
175
176            endif
177
178        [...]
179
180        If TEXTURE_MAG_FILTER is not NEAREST or TEXTURE_MIN_FILTER is
181        not NEAREST or NEAREST_MIPMAP_NEAREST then r may be computed by
182        comparing more than one depth texture value and texture R
183        coordinate.  The details of this are implementation-dependent
184        but r should be a value in the range
185        [TEXTURE_COMPARE_FAIL_VALUE_ARB, 1] and proportional to the
186        number of comparison passes or failures.
187
188        [...]
189
190Additions to Chapter 4 of the 1.3 Specification (Per-Fragment Operations
191and the Frame Buffer)
192
193    None
194
195Additions to Chapter 5 of the 1.3 Specification (Special Functions)
196
197    None
198
199Additions to Chapter 6 of the 1.3 Specification (State and State Requests)
200
201    In section 6.1.3, p. 200, change the paragraph introduced by the
202    ARB_shadow extension to be:
203
204    "The texture compare mode, function, result format and comparison
205    failure value may be queried by calling GetTexParameteriv or
206    GetTexParameterfv with <pname> set to TEXTURE_COMPARE_MODE_ARB,
207    TEXTURE_COMPARE_FUNC_ARB, TEXTURE_COMPARE_RESULT_ARB, or
208    TEXTURE_COMPARE_FAIL_VALUE_ARB, respectively."
209
210Additions to the GLX Specification
211
212    None
213
214Errors
215
216    None.
217
218New State
219
220    In table 6.16, Texture Objects, p. 224, add the following:
221
222    Get Value                      Type   Get Command          Init Val Description                Sec.   Attribute
223    ------------------------------ ------ -------------------- -------- -------------------------- ------ ---------
224    TEXTURE_COMPARE_FAIL_VALUE_ARB R[0,1] GetTexParameter[if]v   0.0    texture compare fail value 3.8.13 texture
225
226New Implementation Dependent State
227
228    None
229
230Revision History
231
232    16 April 2001
233        - initial version
234    22 April 2001
235        - rename TEXTURE_FAIL_LUMINANCE_ARB to TEXTURE_FAIL_VALUE_ARB.
236    23 April 2001
237        - minor tweaks
238    16 November 2001
239        - rename TEXTURE_FAIL_VALUE_ARB to TEXTURE_COMPARE_FAIL_VALUE_ARB
240    17 November 2001
241        - adjusted 3.8.7.1 section number
242    18 November 2001
243        - Clarify that TEXTURE_COMPARE_FAIL_VALUE_ARB is clamped to [0,1]
244        - added issue 6
245        - let TEXTURE_COMPARE_FAIL_VALUE_ARB be the same as SHADOW_AMBIENT_SGIX
246    12 December 2001
247        - rewritten against the OpenGL 1.3 spec
248        - fixed some typos
249