Name

    SGIX_texture_lod_bias

Name Strings

    GL_SGIX_texture_lod_bias

Version

    $Date: 2005/06/02 18:12:32 $ $Revision: 1.1 $

Number

    84

Dependencies

    EXT_texture is required
    EXT_texture3D affects the definition of this extension
    EXT_texture_object affects the definition of this extension

Overview

    This extension modifies the calculation of texture level of detail 
    parameter LOD, which is represented by the Greek character lambda
    in the GL Specification. The LOD equation assumes that a 2^n x 2^m x 2^l
    texture is band limited at 2^(n-1), 2^(m-1), 2^(l-1).  Often a texture is 
    oversampled or filtered such that the texture is band limited at lower
    frequencies in one or more dimensions.  The result is that texture-mapped 
    primitives appear excessively blurry.  This extension provides biases 
    for n, m, and l in the LOD calculation to to compensate for under or over 
    sampled texture images.  Mipmapped textures can be made to appear sharper or
    blurrier by supplying a negative or positive bias respectively. 

    Examples of textures which can benefit from this LOD control include
    video-capture images which are filtered differently horizontally and
    vertically; a texture which appears blurry because it is mapped with 
    a nonuniform scale, such as a road texture which is repeated hundreds of 
    times in one dimension and only once in the other; and textures which
    had to be magnified to a power-of-two for mipmapping.

Issues

    *	Should "bias" be changed to "offset"?

New Procedures and Functions

    None

New Tokens

    Accepted by the <pname> parameter of TexParameteri, TexParameterf,
    TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv:

	TEXTURE_LOD_BIAS_S_SGIX
	TEXTURE_LOD_BIAS_T_SGIX
	TEXTURE_LOD_BIAS_R_SGIX

Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation)

    None

Additions to Chapter 3 of the 1.0 Specification (Rasterization)

    GL Specification Table 3.7 is updated as follows:

	Name				Type	    Legal Values
	----				----	    ------------
	TEXTURE_WRAP_S			integer	    CLAMP, REPEAT
	TEXTURE_WRAP_T			integer	    CLAMP, REPEAT
	TEXTURE_WRAP_R_EXT		integer	    CLAMP, REPEAT
	TEXTURE_MIN_FILTER		integer	    NEAREST, LINEAR,
						    NEAREST_MIPMAP_NEAREST,
						    NEAREST_MIPMAP_LINEAR,
						    LINEAR_MIPMAP_NEAREST,
						    LINEAR_MIPMAP_LINEAR,
						    FILTER4_SGIS
	TEXTURE_MAG_FILTER		integer	    NEAREST, LINEAR,
						    FILTER4_SGIS,
						    LINEAR_DETAIL_SGIS,
						    LINEAR_DETAIL_ALPHA_SGIS,
						    LINEAR_DETAIL_COLOR_SGIS,
						    LINEAR_SHARPEN_SGIS,
						    LINEAR_SHARPEN_ALPHA_SGIS,
						    LINEAR_SHARPEN_COLOR_SGIS
	TEXTURE_BORDER_COLOR		4 floats    any 4 values in [0,1]
	DETAIL_TEXTURE_LEVEL_SGIS	integer	    any non-negative integer
	DETAIL_TEXTURE_MODE_SGIS	integer	    ADD, MODULATE
	TEXTURE_MIN_LOD_SGIS		float	    any value
	TEXTURE_MAX_LOD_SGIS		float	    any value
	TEXTURE_BASE_LEVEL_SGIS		integer	    any non-negative integer
	TEXTURE_MAX_LEVEL_SGIS		integer	    any non-negative integer
	TEXTURE_LOD_BIAS_S_SGIX	float	    any value
	TEXTURE_LOD_BIAS_T_SGIX	float	    any value
	TEXTURE_LOD_BIAS_R_SGIX	float	    any value

	Table 3.7: Texture parameters and their values.

   Level of Detail Bias
   ------------------------

   This extensions redefines the equations 3.8 and 3.9 for P in Section 3.8.1 
   (Texture Minification) of the GL Specification as follows:
	
	P = max { sqrt((dlodu/dx)^2 + (dlodv/dx)^2 + (dlodw/dx)^2), 
			    sqrt((dlodu/dy)^2 + (dlodv/dy)^2 + (dlodw/dy)^2) }	(3.8)	

	where 
		dlodu/dx = 2^TEXTURE_LOD_BIAS_S_SGIX * du/dx
		dlodv/dx = 2^TEXTURE_LOD_BIAS_T_SGIX * dv/dx
		dlodw/dx = 2^TEXTURE_LOD_BIAS_R_SGIX * dw/dx
		dlodu/dy = 2^TEXTURE_LOD_BIAS_S_SGIX * du/dy
		dlodv/dy = 2^TEXTURE_LOD_BIAS_T_SGIX * dv/dy
		dlodw/dy = 2^TEXTURE_LOD_BIAS_R_SGIX * dw/dy

    For a line the equation is redefined as:
		
	P = sqrt((dlodu/dx * deltaX + dlodu/dy * deltaY)^2 + 
		(dlodv/dx * deltaX + dlodv/dy * deltaY)^2 +
		(dlodw/dx * deltaX + dlodw/dy * deltaY)^2) / l		(3.9)

    The conditions for f(x,y) in section 3.8.1 are similarly changed:
    
    1. f(x,y) is continuous and monotonically increasing in each of |dlodu/dx|,
       |dlodu/dy|, |dlodv/dx|, |dlodv/dy|, |dlodw/dx|, and |dlodw/dy|,

    2. Let
	Mu = max {|dlodu/dx|, |dlodu/dy|}, Mv = max {|dlodv/dx|, |dlodv/dy|},
	and Mw = max {|dlodw/dx|, |dlodw/dy|}.

	Then max{Mu,Mv,Mw} <= f(x,y) < Mu + Mv + Mw.

    By default TEXTURE_LOD_BIAS_S_SGIX, TEXTURE_LOD_BIAS_T_SGIX, and 
    TEXTURE_LOD_BIAS_R_SGIX are 0, so they do not interfere with the normal 
    operation of texture mapping.  These values are respecified for a specific 
    texture by calling TexParameteri, TexParemeterf, TexParameteriv, or
    TexParameterfv with <target> set to TEXTURE_1D, TEXTURE_2D, or
    TEXTURE_3D_EXT, <pname> set to one of the LOD Bias names,
    and <param> set to (or <params> pointing to) the new value.  

Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations
and the Frame Buffer)

    None

Additions to Chapter 5 of the 1.0 Specification (Special Functions)

    None

Additions to Chapter 6 of the 1.0 Specification (State and State Requests)

    None

Additions to the GLX Specification

    None

Dependencies on EXT_texture

    EXT_texture is required.

Dependencies on EXT_texture3D

    If EXT_texture3D is not supported, references to 3D texture mapping and
    to TEXTURE_3D_EXT in this document are invalid and should be ignored.

Dependencies on EXT_texture_object

    If EXT_texture_object is implemented, the state values named

	TEXTURE_LOD_BIAS_S_SGIX	float	    any value
	TEXTURE_LOD_BIAS_T_SGIX	float	    any value
	TEXTURE_LOD_BIAS_R_SGIX	float	    any value

    are added to the state vector of each texture object. When an attribute
    set that includes texture information is popped, the bindings and
    enables are first restored to their pushed values, then the bound
    textures have their LOD_BIAS parameters restored to their pushed
    values.

Errors

    None

New State

								Initial
    Get Value			Get Command	    Type	Value	Attrib
    ---------			-----------	    ----	-------	------
    TEXTURE_LOD_BIAS_S_SGIX	GetTexParameterfv   n x R 	    0   texture
    TEXTURE_LOD_BIAS_T_SGIX	GetTexParameterfv   n x R 	    0   texture
    TEXTURE_LOD_BIAS_R_SGIX	GetTexParameterfv   n x R 	    0   texture

New Implementation Dependent State

    None
