15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_shadow 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_ARB_shadow 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Brian Paul (brian_e_paul 'at' yahoo.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNotice 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Copyright (c) 2002-2013 The Khronos Group Inc. Copyright terms at 165bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciSpecification Update Policy 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 215bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 225bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 235bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 245bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 255bd8deadSopenharmony_ci described in more detail at 265bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciStatus 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Complete. Approved by ARB on February 14, 2002. 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciVersion 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Last Modified Date: 21 January 2002 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ciNumber 375bd8deadSopenharmony_ci 385bd8deadSopenharmony_ci ARB Extension #23 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciDependencies 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci OpenGL 1.1 is required. 435bd8deadSopenharmony_ci ARB_depth_texture is required. 445bd8deadSopenharmony_ci This extension is written against the OpenGL 1.3 Specification. 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ciOverview 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci This extension clarifies the GL_SGIX_shadow extension. 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci This extension supports comparing the texture R coordinate to a depth 515bd8deadSopenharmony_ci texture value in order to produce a boolean texture value. This can 525bd8deadSopenharmony_ci be used to implement shadow maps. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ci The extension is written in generic terms such that other texture 555bd8deadSopenharmony_ci comparison modes can be accommodated in the future. 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ciIP Status 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ci XXX None? 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ciIssues 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci (1) How is this extension different from GL_SGIX_shadow? 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci - It defines GL behaviour when the currently bound texture is not 665bd8deadSopenharmony_ci a depth texture. 675bd8deadSopenharmony_ci - It specifies that R is clamped to [0,1]. 685bd8deadSopenharmony_ci - We use the standard GL_LEQUAL and GL_GEQUAL tokens instead of 695bd8deadSopenharmony_ci defining new ones. 705bd8deadSopenharmony_ci - The result may be ALPHA, LUMINANCE or INTENSITY. 715bd8deadSopenharmony_ci - A bit more is said about how depth textures are sampled. 725bd8deadSopenharmony_ci - The extension is generalized for comparison modes. 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci (2) Should we use GL_LEQUAL and GL_EQUAL instead of 755bd8deadSopenharmony_ci GL_TEXTURE_LEQUAL_R_SGIX and GL_TEXTURE_GEQUAL_R_SGIX? 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci RESOLUTION: Yes. The old tokens are misleading. For example, 785bd8deadSopenharmony_ci the GL_TEXTURE_LEQUAL_R_SGIX token should really have been named 795bd8deadSopenharmony_ci GL_R_LEQUAL_TEXTURE_SGIX since we're comparing R <= TEXTURE. 805bd8deadSopenharmony_ci This extension uses the standard GL_LEQUAL and GL_GEQUAL tokens. 815bd8deadSopenharmony_ci Also, the original shadow spec seems to be inconsistant with 825bd8deadSopenharmony_ci what was really implemented in hardware. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci (3) Use TEXTURE_COMPARE_OPERATOR_ARB or TEXTURE_COMPARE_FUNC_ARB? 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ci RESOLVED: Use TEXTURE_COMPARE_FUNC_ARB to be more consistant with 875bd8deadSopenharmony_ci the conventions of glDepthFunc(), glStencilFunc(), etc which use 885bd8deadSopenharmony_ci the GL_LEQUAL, GL_GEQUAL, etc tokens. 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci (4) Should the result of the texture comparison be a LUMINANCE, 915bd8deadSopenharmony_ci INTENSITY or ALPHA texel? 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci RESOLVED: Allow any of them. This is controlled by 945bd8deadSopenharmony_ci DEPTH_TEXTURE_MODE_ARB defined in ARB_depth_texture extension. 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci (5) What if TEXTURE_COMPARE_MODE_ARB is set to COMPARE_R_TO_TEXTURE 975bd8deadSopenharmony_ci but the the currently bound texture is not a depth texture? 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ci RESOLVED: If the currently bound texture is a color (or paletted 1005bd8deadSopenharmony_ci or color index) texture then the texture unit treats it in the 1015bd8deadSopenharmony_ci usual manner and all texture comparison logic is bypassed. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ci (6) Should the R value be clamped to [0,1] before the comparison? 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci RESOLUTION: Yes, that makes sense since the depth texels are in 1065bd8deadSopenharmony_ci the range [0,1]. Note that clamping R to [0,1] really only matters 1075bd8deadSopenharmony_ci at the values 0 and 1. 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci (7) How is bilinear or trilinear filtering implemented? 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci RESOLUTION: We suggest an implementation behaviour but leave the 1125bd8deadSopenharmony_ci details up to the implementation. Differences here amount to the 1135bd8deadSopenharmony_ci quality and softness of shadow edges. Specific filtering 1145bd8deadSopenharmony_ci algorithms could be expressed via layered extensions. We're 1155bd8deadSopenharmony_ci intentionally vague here to avoid IP and patent issues. 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci (8) Is GL_ARB_shadow the right name for this extension? 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci RESOLVED: Probably. While this extension is expressed in rather 1205bd8deadSopenharmony_ci generic terms which may be used by future extensions, it implements 1215bd8deadSopenharmony_ci a rather specific operation at this time. 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci (9) What about GL_SGIX_shadow_ambient? 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci RESOLUTION: Omit that functionality. It can be accomplished with 1265bd8deadSopenharmony_ci advanced texture extensions such as GL_NV_register_combiners. 1275bd8deadSopenharmony_ci GL_SGIX_shadow_ambient usually can't be implemented with existing 1285bd8deadSopenharmony_ci hardware so it'll be offered as GL_ARB_shadow_ambient, rather than 1295bd8deadSopenharmony_ci burdon this extension with it. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciNew Procedures and Functions 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci None 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ciNew Tokens 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci Accepted by the <pname> parameter of TexParameterf, TexParameteri, 1385bd8deadSopenharmony_ci TexParameterfv, TexParameteriv, GetTexParameterfv, and GetTexParameteriv: 1395bd8deadSopenharmony_ci 1405bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB 0x884C 1415bd8deadSopenharmony_ci TEXTURE_COMPARE_FUNC_ARB 0x884D 1425bd8deadSopenharmony_ci 1435bd8deadSopenharmony_ci Accepted by the <param> parameter of TexParameterf, TexParameteri, 1445bd8deadSopenharmony_ci TexParameterfv, and TexParameteriv when the <pname> parameter is 1455bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB: 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci COMPARE_R_TO_TEXTURE_ARB 0x884E 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.3 Specification (OpenGL Operation) 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci None 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.3 Specification (Rasterization) 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci Section 3.8.4, Texture Parameters, p. 133, append table 3.19 with the 1565bd8deadSopenharmony_ci following: 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci Name Type Legal Values 1595bd8deadSopenharmony_ci -------------------------- ---- ------------------------------- 1605bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB enum NONE, COMPARE_R_TO_TEXTURE 1615bd8deadSopenharmony_ci TEXTURE_COMPARE_FUNC_ARB enum LEQUAL, GEQUAL 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci After section 3.8.12, Texture Environments and Texture Functions, 1645bd8deadSopenharmony_ci p. 149, insert the following new sections (and renumber subsequent 1655bd8deadSopenharmony_ci sections): 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci "3.8.13 Texture Comparison Modes 1685bd8deadSopenharmony_ci 1695bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB can be used to compute the texture value 1705bd8deadSopenharmony_ci according to a comparison function. TEXTURE_COMPARE_MODE_ARB 1715bd8deadSopenharmony_ci specifies the comparison operands, and TEXTURE_COMPARE_FUNC_ARB 1725bd8deadSopenharmony_ci specifies the comparison function. The format of the resulting 1735bd8deadSopenharmony_ci texture sample is specified by the DEPTH_TEXTURE_MODE_ARB. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci 3.8.13.1 Depth Texture Comparison Mode 1765bd8deadSopenharmony_ci 1775bd8deadSopenharmony_ci If the currently bound texture's format is DEPTH_COMPONENT then 1785bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB, TEXTURE_COMPARE_FUNC_ARB and 1795bd8deadSopenharmony_ci DEPTH_TEXTURE_MODE_ARB control the output of the texture unit 1805bd8deadSopenharmony_ci as described below. However, if the currently bound texture is 1815bd8deadSopenharmony_ci not DEPTH_COMPONENT then the texture unit operates in the normal 1825bd8deadSopenharmony_ci manner and texture comparison is bypassed. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Let Dt (D subscript t) be the depth texture value, in the range 1855bd8deadSopenharmony_ci [0, 1]. Let R be the interpolated texture coordinate clamped to 1865bd8deadSopenharmony_ci the range [0, 1]. Then the effective texture value Lt, It, or At 1875bd8deadSopenharmony_ci is computed by 1885bd8deadSopenharmony_ci 1895bd8deadSopenharmony_ci if TEXTURE_COMPARE_MODE_ARB = NONE 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci r = Dt 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci else if TEXTURE_COMPARE_MODE_ARB = COMPARE_R_TO_TEXTURE_ARB 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci if TEXTURE_COMPARE_FUNC_ARB = LEQUAL 1965bd8deadSopenharmony_ci 1975bd8deadSopenharmony_ci { 1.0, if R <= Dt 1985bd8deadSopenharmony_ci r = { 1995bd8deadSopenharmony_ci { 0.0, if R > Dt 2005bd8deadSopenharmony_ci 2015bd8deadSopenharmony_ci else if TEXTURE_COMPARE_FUNC_ARB = GEQUAL 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci { 1.0, if R >= Dt 2045bd8deadSopenharmony_ci r = { 2055bd8deadSopenharmony_ci { 0.0, if R < Dt 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci endif 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci if DEPTH_TEXTURE_MODE_ARB = LUMINANCE 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci Lt = r 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ci else if DEPTH_TEXTURE_MODE_ARB = INTENSITY 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci It = r 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ci else if DEPTH_TEXTURE_MODE_ARB = ALPHA 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ci At = r 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci endif 2225bd8deadSopenharmony_ci 2235bd8deadSopenharmony_ci endif 2245bd8deadSopenharmony_ci 2255bd8deadSopenharmony_ci If TEXTURE_MAG_FILTER is not NEAREST or TEXTURE_MIN_FILTER is 2265bd8deadSopenharmony_ci not NEAREST or NEAREST_MIPMAP_NEAREST then r may be computed by 2275bd8deadSopenharmony_ci comparing more than one depth texture value to the texture R 2285bd8deadSopenharmony_ci coordinate. The details of this are implementation-dependent 2295bd8deadSopenharmony_ci but r should be a value in the range [0, 1] which is proportional 2305bd8deadSopenharmony_ci to the number of comparison passes or failures. 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.3 Specification (Per-Fragment Operations 2335bd8deadSopenharmony_ciand the Frame Buffer) 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci None 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.3 Specification (Special Functions) 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci None 2405bd8deadSopenharmony_ci 2415bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.3 Specification (State and State Requests) 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci In section 6.1.3, p. 200, insert the following after the fourth 2445bd8deadSopenharmony_ci paragraph: 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci "The texture compare mode and texture compare function may be queried 2475bd8deadSopenharmony_ci by calling GetTexParameteriv or GetTexParameterfv with <pname> set to 2485bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB, or TEXTURE_COMPARE_FUNC_ARB, respectively." 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ciAdditions to the GLX Specification 2515bd8deadSopenharmony_ci 2525bd8deadSopenharmony_ci None 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ciErrors 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci INVALID_ENUM is generated if TexParameter[if] parameter <pname> 2575bd8deadSopenharmony_ci is TEXTURE_COMPARE_MODE_ARB and parameter <param> is not NONE or 2585bd8deadSopenharmony_ci COMPARE_R_TO_TEXTURE. 2595bd8deadSopenharmony_ci 2605bd8deadSopenharmony_ci INVALID_ENUM is generated if TexParameter[if] parameter <pname> 2615bd8deadSopenharmony_ci is TEXTURE_COMPARE_FUNC_ARB and parameter <param> is not LEQUAL or 2625bd8deadSopenharmony_ci GEQUAL. 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ciNew State 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci In table 6.16, Texture Objects, p. 224, add the following: 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci Get Value Type Get Command Initial Value Description Sec. Attribute 2695bd8deadSopenharmony_ci -------------------------- ---- -------------------- ------------- -------------- ----- --------- 2705bd8deadSopenharmony_ci TEXTURE_COMPARE_MODE_ARB Z_2 GetTexParameter[if]v NONE compare mode 3.8.13 texture 2715bd8deadSopenharmony_ci TEXTURE_COMPARE_FUNC_ARB Z_2 GetTexParameter[if]v LEQUAL compare func 3.8.13 texture 2725bd8deadSopenharmony_ci 2735bd8deadSopenharmony_ciNew Implementation Dependent State 2745bd8deadSopenharmony_ci 2755bd8deadSopenharmony_ci None 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ciRevision History 2785bd8deadSopenharmony_ci 2795bd8deadSopenharmony_ci 19 March 2001 2805bd8deadSopenharmony_ci - initial revision 2815bd8deadSopenharmony_ci 20 March 2001 2825bd8deadSopenharmony_ci - use GL_LEQUAL, GL_GEQUAL tokens 2835bd8deadSopenharmony_ci - removed TEXTURE_COMPARE_FAIL_VALUE_ARB 2845bd8deadSopenharmony_ci 16 April 2001 2855bd8deadSopenharmony_ci - renamed TEXTURE_COMPARE_OPERATOR_ARB to TEXTURE_COMPARE_FUNC_ARB 2865bd8deadSopenharmony_ci - replace TEXTURE_COMPARE_ARB with TEXTURE_COMPARE_MODE_ARB 2875bd8deadSopenharmony_ci 22 April 2001 2885bd8deadSopenharmony_ci - added TEXTURE_COMPARE_RESULT 2895bd8deadSopenharmony_ci 23 April 2001 2905bd8deadSopenharmony_ci - minor tweaks 2915bd8deadSopenharmony_ci 22 June 2001 2925bd8deadSopenharmony_ci - fixed grammatical errors 2935bd8deadSopenharmony_ci 16 November 2001 2945bd8deadSopenharmony_ci - Change default value of TEXTURE_COMPARE_MODE_ARB to LUMINANCE. 2955bd8deadSopenharmony_ci 17 November 2001 2965bd8deadSopenharmony_ci - Resolved issue 5 2975bd8deadSopenharmony_ci - cleaned up new section 3.8.7.1 yet again 2985bd8deadSopenharmony_ci 12 December 2001 2995bd8deadSopenharmony_ci - rewritten against the OpenGL 1.3 spec 3005bd8deadSopenharmony_ci 3 January 2002 3015bd8deadSopenharmony_ci - fixed a typo found by Bimal 3025bd8deadSopenharmony_ci 18 January 2002 3035bd8deadSopenharmony_ci - Since depth textures can now allow ALPHA, INTENSITY, LUMINANCE mode, 3045bd8deadSopenharmony_ci there was no need for TEXTURE_COMPARE_RESULT_ARB. 3055bd8deadSopenharmony_ci 21 January 2002 3065bd8deadSopenharmony_ci - Fixed error to be INVALID_ENUM instead of INVALID_OPERATION. 307