OGRE Manual v1.8 ('Byatis'): 3.1.3 Texture Units

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 3.1.3 Texture Units

Here are the attributes you can use in a 'texture_unit' section of a .material script:

## Available Texture Layer Attributes

- texture_alias

- texture

- anim_texture

- cubic_texture

- tex_coord_set

- tex_address_mode

- tex_border_colour

- filtering

- max_anisotropy

- mipmap_bias

- colour_op

- colour_op_ex

- colour_op_multipass_fallback

- alpha_op_ex

- env_map

- scroll

- scroll_anim

- rotate

- rotate_anim

- scale

- wave_xform

- transform

- binding_type

- content_type

You can also use a nested 'texture_source' section in order to use a special add-in as a source of texture data, See section External Texture Sources for details.

## Attribute Descriptions

### texture_alias

Sets the alias name for this texture unit.

Format: texture_alias <name>

Example: texture_alias NormalMap

Setting the texture alias name is useful if this material is to be inherited by other other materials and only the textures will be changed in the new material.(See section Texture Aliases)
Default: If a texture_unit has a name then the texture_alias defaults to the texture_unit name.

### texture

Sets the name of the static texture image this layer will use.

Format: texture <texturename> [<type>] [unlimited | numMipMaps] [alpha] [<PixelFormat>] [gamma]

Example: texture funkywall.jpg

This setting is mutually exclusive with the anim_texture attribute. Note that the texture file cannot include spaces. Those of you Windows users who like spaces in filenames, please get over it and use underscores instead.
The 'type' parameter allows you to specify a the type of texture to create - the default is '2d', but you can override this; here's the full list:

1d

  A 1-dimensional texture; that is, a texture which is only 1 pixel high. These kinds of textures can be useful when you need to encode a function in a texture and use it as a simple lookup, perhaps in a fragment program. It is important that you use this setting when you use a fragment program which uses 1-dimensional texture coordinates, since GL requires you to use a texture type that matches (D3D will let you get away with it, but you ought to plan for cross-compatibility). Your texture widths should still be a power of 2 for best compatibility and performance.

2d

  The default type which is assumed if you omit it, your texture has a width and a height, both of which should preferably be powers of 2, and if you can, make them square because this will look best on the most hardware. These can be addressed with 2D texture coordinates.

3d

  A 3 dimensional texture i.e. volume texture. Your texture has a width, a height, both of which should be powers of 2, and has depth. These can be addressed with 3d texture coordinates i.e. through a pixel shader.

cubic

  This texture is made up of 6 2D textures which are pasted around the inside of a cube. Can be addressed with 3D texture coordinates and are useful for cubic reflection maps and normal maps.

The 'numMipMaps' option allows you to specify the number of mipmaps to generate for this texture. The default is 'unlimited' which means mips down to 1x1 size are generated. You can specify a fixed number (even 0) if you like instead. Note that if you use the same texture in many material scripts, the number of mipmaps generated will conform to the number specified in the first texture_unit used to load the texture - so be consistent with your usage.

The 'alpha' option allows you to specify that a single channel (luminance) texture should be loaded as alpha, rather than the default which is to load it into the red channel. This can be helpful if you want to use alpha-only textures in the fixed function pipeline.

Default: none

The <PixelFormat> option allows you to specify the desired pixel format of the texture to create, which may be different to the pixel format of the texture file being loaded. Bear in mind that the final pixel format will be constrained by hardware capabilities so you may not get exactly what you ask for. The available options are:

PF_L8

  8-bit pixel format, all bits luminance.

PF_L16

  16-bit pixel format, all bits luminance.

PF_A8

  8-bit pixel format, all bits alpha.

PF_A4L4

  8-bit pixel format, 4 bits alpha, 4 bits luminance.

PF_BYTE_LA

  2 byte pixel format, 1 byte luminance, 1 byte alpha

PF_R5G6B5

  16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.

PF_B5G6R5

  16-bit pixel format, 5 bits blue, 6 bits green, 5 bits red.

PF_R3G3B2

  8-bit pixel format, 3 bits red, 3 bits green, 2 bits blue.

PF_A4R4G4B4

  16-bit pixel format, 4 bits for alpha, red, green and blue.

PF_A1R5G5B5

  16-bit pixel format, 1 bit for alpha, 5 bits for red, green and blue.

PF_R8G8B8

  24-bit pixel format, 8 bits for red, green and blue.

PF_B8G8R8

  24-bit pixel format, 8 bits for blue, green and red.

PF_A8R8G8B8

  32-bit pixel format, 8 bits for alpha, red, green and blue.

PF_A8B8G8R8

  32-bit pixel format, 8 bits for alpha, blue, green and red.

PF_B8G8R8A8

  32-bit pixel format, 8 bits for blue, green, red and alpha.

PF_R8G8B8A8

  32-bit pixel format, 8 bits for red, green, blue and alpha.

PF_X8R8G8B8

  32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue like PF_A8R8G8B8, but alpha will get discarded

PF_X8B8G8R8

  32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red like PF_A8B8G8R8, but alpha will get discarded

PF_A2R10G10B10

  32-bit pixel format, 2 bits for alpha, 10 bits for red, green and blue.

PF_A2B10G10R10

  32-bit pixel format, 2 bits for alpha, 10 bits for blue, green and red.

PF_DXT1

  DDS (DirectDraw Surface) DXT1 format

PF_DXT2

  DDS (DirectDraw Surface) DXT2 format

PF_DXT3

  DDS (DirectDraw Surface) DXT3 format

PF_DXT4

  DDS (DirectDraw Surface) DXT4 format

PF_DXT5

  DDS (DirectDraw Surface) DXT5 format

PF_FLOAT16_R

  16-bit pixel format, 16 bits (float) for red

PF_FLOAT16_RGB

  48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue

PF_FLOAT16_RGBA

  64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue, 16 bits (float) for alpha

PF_FLOAT32_R

  16-bit pixel format, 16 bits (float) for red

PF_FLOAT32_RGB

  96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue

PF_FLOAT32_RGBA

  128-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue, 32 bits (float) for alpha

PF_SHORT_RGBA

  64-bit pixel format, 16 bits for red, green, blue and alpha

PF_FLOAT16_GR

  32-bit, 2-channel s10e5 floating point pixel format, 16-bit green, 16-bit red

PF_FLOAT32_GR

  64-bit, 2-channel floating point pixel format, 32-bit green, 32-bit red

PF_DEPTH

  Depth texture format

PF_SHORT_GR

  32-bit pixel format, 16-bit green, 16-bit red

PF_SHORT_RGB

  48-bit pixel format, 16 bits for red, green and blue

PF_PVRTC_RGB2

  PVRTC (PowerVR) RGB 2 bpp

PF_PVRTC_RGBA2

  PVRTC (PowerVR) RGBA 2 bpp

PF_PVRTC_RGB4

  PVRTC (PowerVR) RGB 4 bpp

PF_PVRTC_RGBA4

  PVRTC (PowerVR) RGBA 4 bpp

PF_R8

  8-bit pixel format, all bits red.

PF_RG8

  16-bit pixel format, 8 bits red, 8 bits green.

The 'gamma' option informs the renderer that you want the graphics hardware to perform gamma correction on the texture values as they are sampled for rendering. This is only applicable for textures which have 8-bit colour channels (e.g.PF_R8G8B8). Often, 8-bit per channel textures will be stored in gamma space in order to increase the precision of the darker colours (http://en.wikipedia.org/wiki/Gamma_correction) but this can throw out blending and filtering calculations since they assume linear space colour values. For the best quality shading, you may want to enable gamma correction so that the hardware converts the texture values to linear space for you automatically when sampling the texture, then the calculations in the pipeline can be done in a reliable linear colour space. When rendering to a final 8-bit per channel display, you'll also want to convert back to gamma space which can be done in your shader (by raising to the power 1/2.2) or you can enable gamma correction on the texture being rendered to or the render window. Note that the 'gamma' option on textures is applied on loading the texture so must be specified consistently if you use this texture in multiple places.

### anim_texture

Sets the images to be used in an animated texture layer. In this case an animated texture layer means one which has multiple frames, each of which is a separate image file. There are 2 formats, one for implicitly determined image names, one for explicitly named images.

Format1 (short): anim_texture <base_name> <num_frames> <duration>

Example: anim_texture flame.jpg 5 2.5

This sets up an animated texture layer made up of 5 frames named flame_0.jpg, flame_1.jpg, flame_2.jpg etc, with an animation length of 2.5 seconds (2fps). If duration is set to 0, then no automatic transition takes place and frames must be changed manually in code.

Format2 (long): anim_texture <frame1> <frame2> ... <duration>

Example: anim_texture flamestart.jpg flamemore.png flameagain.jpg moreflame.jpg lastflame.tga 2.5

This sets up the same duration animation but from 5 separately named image files. The first format is more concise, but the second is provided if you cannot make your images conform to the naming standard required for it.

Default: none

### cubic_texture

Sets the images used in a cubic texture, i.e. one made up of 6 individual images making up the faces of a cube. These kinds of textures are used for reflection maps (if hardware supports cubic reflection maps) or skyboxes. There are 2 formats, a brief format expecting image names of a particular format and a more flexible but longer format for arbitrarily named textures.

Format1 (short): cubic_texture <base_name> <combinedUVW|separateUV>

The base_name in this format is something like 'skybox.jpg', and the system will expect you to provide skybox_fr.jpg, skybox_bk.jpg, skybox_up.jpg, skybox_dn.jpg, skybox_lf.jpg, and skybox_rt.jpg for the individual faces.

Format2 (long): cubic_texture <front> <back> <left> <right> <up> <down> separateUV

In this case each face is specified explicitly, incase you don't want to conform to the image naming standards above. You can only use this for the separateUV version since the combinedUVW version requires a single texture name to be assigned to the combined 3D texture (see below).

In both cases the final parameter means the following:

combinedUVW

  The 6 textures are combined into a single 'cubic' texture map which is then addressed using 3D texture coordinates with U, V and W components. Necessary for reflection maps since you never know which face of the box you are going to need. Note that not all cards support cubic environment mapping.

separateUV

  The 6 textures are kept separate but are all referenced by this single texture layer. One texture at a time is active (they are actually stored as 6 frames), and they are addressed using standard 2D UV coordinates. This type is good for skyboxes since only one face is rendered at one time and this has more guaranteed hardware support on older cards.

Default: none

### binding_type

Tells this texture unit to bind to either the fragment processing unit or the vertex processing unit (for Vertex Texture Fetch).

Format: binding_type <vertex|fragment> Default: binding_type fragment

### content_type

Tells this texture unit where it should get its content from. The default is to get texture content from a named texture, as defined with the texture, cubic_texture, anim_texture attributes. However you can also pull texture information from other automated sources. The options are:

named

  The default option, this derives texture content from a texture name, loaded by ordinary means from a file or having been manually created with a given name.

shadow

  This option allows you to pull in a shadow texture, and is only valid when you use texture shadows and one of the 'custom sequence' shadowing types (See section Shadows). The shadow texture in question will be from the 'n'th closest light that casts shadows, unless you use light-based pass iteration or the light_start option which may start the light index higher. When you use this option in multiple texture units within the same pass, each one references the next shadow texture. The shadow texture index is reset in the next pass, in case you want to take into account the same shadow textures again in another pass (e.g. a separate specular / gloss pass). By using this option, the correct light frustum projection is set up for you for use in fixed-function, if you use shaders just reference the texture_viewproj_matrix auto parameter in your shader.

compositor

  This option allows you to reference a texture from a compositor, and is only valid when the pass is rendered within a compositor sequence. This can be either in a render_scene directive inside a compositor script, or in a general pass in a viewport that has a compositor attached. Note that this is a reference only, meaning that it does not change the render order. You must make sure that the order is reasonable for what you are trying to achieve (for example, texture pooling might cause the referenced texture to be overwritten by something else by the time it is referenced).
  The extra parameters for the content_type are only required for this type:
  The first is the name of the compositor being referenced. (Required)
  The second is the name of the texture to reference in the compositor. (Required)
  The third is the index of the texture to take, in case of an MRT. (Optional)

Format: content_type <named|shadow|compositor> [<Referenced Compositor Name>] [<Referenced Texture Name>] [<Referenced MRT Index>]
Default: content_type named
Example: content_type compositor DepthCompositor OutputTexture

### tex_coord_set

Sets which texture coordinate set is to be used for this texture layer. A mesh can define multiple sets of texture coordinates, this sets which one this material uses.

Format: tex_coord_set <set_num>

Example: tex_coord_set 2

Default: tex_coord_set 0

### tex_address_mode

Defines what happens when texture coordinates exceed 1.0 for this texture layer.You can use the simple format to specify the addressing mode for all 3 potential texture coordinates at once, or you can use the 2/3 parameter extended format to specify a different mode per texture coordinate.

Simple Format: tex_address_mode <uvw_mode>
Extended Format: tex_address_mode <u_mode> <v_mode> [<w_mode>]

wrap

  Any value beyond 1.0 wraps back to 0.0. Texture is repeated.

clamp

  Values beyond 1.0 are clamped to 1.0. Texture 'streaks' beyond 1.0 since last line of pixels is used across the rest of the address space. Useful for textures which need exact coverage from 0.0 to 1.0 without the 'fuzzy edge' wrap gives when combined with filtering.

mirror

  Texture flips every boundary, meaning texture is mirrored every 1.0 u or v

border

  Values outside the range [0.0, 1.0] are set to the border colour, you might also set the tex_border_colour attribute too.

Default: tex_address_mode wrap

### tex_border_colour

Sets the border colour of border texture address mode (see tex_address_mode).

Format: tex_border_colour <red> <green> <blue> [<alpha>]
NB valid colour values are between 0.0 and 1.0.

Example: tex_border_colour 0.0 1.0 0.3

Default: tex_border_colour 0.0 0.0 0.0 1.0

### filtering

Sets the type of texture filtering used when magnifying or minifying a texture. There are 2 formats to this attribute, the simple format where you simply specify the name of a predefined set of filtering options, and the complex format, where you individually set the minification, magnification, and mip filters yourself.
Simple Format
Format: filtering <none|bilinear|trilinear|anisotropic>
Default: filtering bilinear
With this format, you only need to provide a single parameter which is one of the following:

none

  No filtering or mipmapping is used. This is equivalent to the complex format 'filtering point point none'.

bilinear

  2x2 box filtering is performed when magnifying or reducing a texture, and a mipmap is picked from the list but no filtering is done between the levels of the mipmaps. This is equivalent to the complex format 'filtering linear linear point'.

trilinear

  2x2 box filtering is performed when magnifying and reducing a texture, and the closest 2 mipmaps are filtered together. This is equivalent to the complex format 'filtering linear linear linear'.

anisotropic

  This is the same as 'trilinear', except the filtering algorithm takes account of the slope of the triangle in relation to the camera rather than simply doing a 2x2 pixel filter in all cases. This makes triangles at acute angles look less fuzzy. Equivalent to the complex format 'filtering anisotropic anisotropic linear'. Note that in order for this to make any difference, you must also set the max_anisotropy attribute too.

Complex Format
Format: filtering <minification> <magnification> <mip>
Default: filtering linear linear point
This format gives you complete control over the minification, magnification, and mip filters. Each parameter can be one of the following:

none

  Nothing - only a valid option for the 'mip' filter , since this turns mipmapping off completely. The lowest setting for min and mag is 'point'.

point

  Pick the closet pixel in min or mag modes. In mip mode, this picks the closet matching mipmap.

linear

  Filter a 2x2 box of pixels around the closest one. In the 'mip' filter this enables filtering between mipmap levels.

anisotropic

  Only valid for min and mag modes, makes the filter compensate for camera-space slope of the triangles. Note that in order for this to make any difference, you must also set the max_anisotropy attribute too.

### max_anisotropy

Sets the maximum degree of anisotropy that the renderer will try to compensate for when filtering textures. The degree of anisotropy is the ratio between the height of the texture segment visible in a screen space region versus the width - so for example a floor plane, which stretches on into the distance and thus the vertical texture coordinates change much faster than the horizontal ones, has a higher anisotropy than a wall which is facing you head on (which has an anisotropy of 1 if your line of sight is perfectly perpendicular to it). You should set the max_anisotropy value to something greater than 1 to begin compensating; higher values can compensate for more acute angles. The maximum value is determined by the hardware, but it is usually 8 or 16.
In order for this to be used, you have to set the minification and/or the magnification filtering option on this texture to anisotropic.

Format: max_anisotropy <value>
Default: max_anisotropy 1

### mipmap_bias

Sets the bias value applied to the mipmapping calculation, thus allowing you to alter the decision of which level of detail of the texture to use at any distance. The bias value is applied after the regular distance calculation, and adjusts the mipmap level by 1 level for each unit of bias. Negative bias values force larger mip levels to be used, positive bias values force smaller mip levels to be used. The bias is a floating point value so you can use values in between whole numbers for fine tuning.
In order for this option to be used, your hardware has to support mipmap biasing (exposed through the render system capabilities), and your minification filtering has to be set to point or linear.

Format: mipmap_bias <value>
Default: mipmap_bias 0

### colour_op

Determines how the colour of this texture layer is combined with the one below it (or the lighting effect on the geometry if this is the first layer).
Note: Only applies to the fixed-function pipeline, if you're using a fragment program this will have no effect.

Format: colour_op <replace|add|modulate|alpha_blend>

This method is the simplest way to blend texture layers, because it requires only one parameter, gives you the most common blending types, and automatically sets up 2 blending methods: one for if single-pass multitexturing hardware is available, and another for if it is not and the blending must be achieved through multiple rendering passes. It is, however, quite limited and does not expose the more flexible multitexturing operations, simply because these can't be automatically supported in multipass fallback mode. If want to use the fancier options, use colour_op_ex, but you'll either have to be sure that enough multitexturing units will be available, or you should explicitly set a fallback using colour_op_multipass_fallback.

replace

  Replace all colour with texture with no adjustment.

add

  Add colour components together.

modulate

  Multiply colour components together.

alpha_blend

  Blend based on texture alpha.

Default: colour_op modulate

### colour_op_ex

This is an extended version of the colour_op attribute which allows extremely detailed control over the blending applied between this and earlier layers. Multitexturing hardware can apply more complex blending operations that multipass blending, but you are limited to the number of texture units which are available in hardware.
Note: Only applies to the fixed-function pipeline, if you're using a fragment program this will have no effect.

Format: colour_op_ex <operation> <source1> <source2> [<manual_factor>] [<manual_colour1>] [<manual_colour2>]

Example colour_op_ex add_signed src_manual src_current 0.5

See the IMPORTANT note below about the issues between multipass and multitexturing that using this method can create. Texture colour operations determine how the final colour of the surface appears when rendered. Texture units are used to combine colour values from various sources (e.g. the diffuse colour of the surface from lighting calculations, combined with the colour of the texture). This method allows you to specify the 'operation' to be used, i.e. the calculation such as adds or multiplies, and which values to use as arguments, such as a fixed value or a value from a previous calculation.

Operation options
  source1

    Use source1 without modification

  source2

    Use source2 without modification

  modulate

    Multiply source1 and source2 together.

  modulate_x2

    Multiply source1 and source2 together, then by 2 (brightening).

  modulate_x4

    Multiply source1 and source2 together, then by 4 (brightening).

  add

    Add source1 and source2 together.

  add_signed

    Add source1 and source2 then subtract 0.5.

  add_smooth

    Add source1 and source2, subtract the product

  subtract

    Subtract source2 from source1

  blend_diffuse_alpha

    Use interpolated alpha value from vertices to scale source1, then add source2 scaled by (1-alpha).

  blend_texture_alpha

    As blend_diffuse_alpha but use alpha from texture

  blend_current_alpha

    As blend_diffuse_alpha but use current alpha from previous stages (same as blend_diffuse_alpha for first layer)

  blend_manual

    As blend_diffuse_alpha but use a constant manual alpha value specified in <manual>

  dotproduct

    The dot product of source1 and source2

  blend_diffuse_colour

    Use interpolated colour value from vertices to scale source1, then add source2 scaled by (1-colour).

Source1 and source2 options
  src_current

    The colour as built up from previous stages.

  src_texture

    The colour derived from the texture assigned to this layer.

  src_diffuse

    The interpolated diffuse colour from the vertices (same as 'src_current' for first layer).

  src_specular

    The interpolated specular colour from the vertices.

  src_manual

    The manual colour specified at the end of the command.

For example 'modulate' takes the colour results of the previous layer, and multiplies them with the new texture being applied. Bear in mind that colours are RGB values from 0.0-1.0 so multiplying them together will result in values in the same range, 'tinted' by the multiply. Note however that a straight multiply normally has the effect of darkening the textures - for this reason there are brightening operations like modulate_x2. Note that because of the limitations on some underlying APIs (Direct3D included) the 'texture' argument can only be used as the first argument, not the second.

Note that the last parameter is only required if you decide to pass a value manually into the operation. Hence you only need to fill these in if you use the 'blend_manual' operation.

IMPORTANT: Ogre tries to use multitexturing hardware to blend texture layers together. However, if it runs out of texturing units (e.g. 2 of a GeForce2, 4 on a GeForce3) it has to fall back on multipass rendering, i.e. rendering the same object multiple times with different textures. This is both less efficient and there is a smaller range of blending operations which can be performed. For this reason, if you use this method you really should set the colour_op_multipass_fallback attribute to specify which effect you want to fall back on if sufficient hardware is not available (the default is just 'modulate' which is unlikely to be what you want if you're doing swanky blending here). If you wish to avoid having to do this, use the simpler colour_op attribute which allows less flexible blending options but sets up the multipass fallback automatically, since it only allows operations which have direct multipass equivalents.

Default: none (colour_op modulate)

### colour_op_multipass_fallback

Sets the multipass fallback operation for this layer, if you used colour_op_ex and not enough multitexturing hardware is available.

Format: colour_op_multipass_fallback <src_factor> <dest_factor>

Example: colour_op_multipass_fallback one one_minus_dest_alpha

Because some of the effects you can create using colour_op_ex are only supported under multitexturing hardware, if the hardware is lacking the system must fallback on multipass rendering, which unfortunately doesn't support as many effects. This attribute is for you to specify the fallback operation which most suits you.

The parameters are the same as in the scene_blend attribute; this is because multipass rendering IS effectively scene blending, since each layer is rendered on top of the last using the same mechanism as making an object transparent, it's just being rendered in the same place repeatedly to get the multitexture effect. If you use the simpler (and less flexible) colour_op attribute you don't need to call this as the system sets up the fallback for you.

### alpha_op_ex

Behaves in exactly the same away as colour_op_ex except that it determines how alpha values are combined between texture layers rather than colour values.The only difference is that the 2 manual colours at the end of colour_op_ex are just single floating-point values in alpha_op_ex. Note: Only applies to the fixed-function pipeline, if you're using a fragment program this will have no effect.

### env_map

Turns on/off texture coordinate effect that makes this layer an environment map.
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect.

Format: env_map <off|spherical|planar|cubic_reflection|cubic_normal>

Environment maps make an object look reflective by using automatic texture coordinate generation depending on the relationship between the objects vertices or normals and the eye.

spherical

  A spherical environment map. Requires a single texture which is either a fish-eye lens view of the reflected scene, or some other texture which looks good as a spherical map (a texture of glossy highlights is popular especially in car sims). This effect is based on the relationship between the eye direction and the vertex normals of the object, so works best when there are a lot of gradually changing normals, i.e. curved objects.

planar

  Similar to the spherical environment map, but the effect is based on the position of the vertices in the viewport rather than vertex normals. This effect is therefore useful for planar geometry (where a spherical env_map would not look good because the normals are all the same) or objects without normals.

cubic_reflection

  A more advanced form of reflection mapping which uses a group of 6 textures making up the inside of a cube, each of which is a view if the scene down each axis. Works extremely well in all cases but has a higher technical requirement from the card than spherical mapping. Requires that you bind a cubic_texture to this texture unit and use the 'combinedUVW' option.

cubic_normal

  Generates 3D texture coordinates containing the camera space normal vector from the normal information held in the vertex data. Again, full use of this feature requires a cubic_texture with the 'combinedUVW' option.

Default: env_map off

### scroll

Sets a fixed scroll offset for the texture.
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: scroll <x> <y>

This method offsets the texture in this layer by a fixed amount. Useful for small adjustments without altering texture coordinates in models. However if you wish to have an animated scroll effect, see the scroll_anim attribute.

### scroll_anim

Sets up an animated scroll for the texture layer. Useful for creating fixed-speed scrolling effects on a texture layer (for varying scroll speeds, see wave_xform).
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: scroll_anim <xspeed> <yspeed>

### rotate

Rotates a texture to a fixed angle. This attribute changes the rotational orientation of a texture to a fixed angle, useful for fixed adjustments. If you wish to animate the rotation, see rotate_anim.
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: rotate <angle>

The parameter is a anti-clockwise angle in degrees.

Note: Only applies to the fixed-function pipeline, if you're using a vertex shader this will have no effect unless you use the texture_matrix auto-param.

### rotate_anim

Sets up an animated rotation effect of this layer. Useful for creating fixed-speed rotation animations (for varying speeds, see wave_xform).
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: rotate_anim <revs_per_second>

The parameter is a number of anti-clockwise revolutions per second.

### scale

Adjusts the scaling factor applied to this texture layer. Useful for adjusting the size of textures without making changes to geometry. This is a fixed scaling factor, if you wish to animate this see wave_xform.
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: scale <x_scale> <y_scale>

Valid scale values are greater than 0, with a scale factor of 2 making the texture twice as big in that dimension etc.

### wave_xform

Sets up a transformation animation based on a wave function. Useful for more advanced texture layer transform effects. You can add multiple instances of this attribute to a single texture layer if you wish.
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: wave_xform <xform_type> <wave_type> <base> <frequency> <phase> <amplitude>

Example: wave_xform scale_x sine 1.0 0.2 0.0 5.0

xform_type
  scroll_x

    Animate the x scroll value

  scroll_y

    Animate the y scroll value

  rotate

    Animate the rotate value

  scale_x

    Animate the x scale value

  scale_y

    Animate the y scale value

wave_type
  sine

    A typical sine wave which smoothly loops between min and max values

  triangle

    An angled wave which increases & decreases at constant speed, changing instantly at the extremes

  square

    Max for half the wavelength, min for the rest with instant transition between

  sawtooth

    Gradual steady increase from min to max over the period with an instant return to min at the end.

  inverse_sawtooth

    Gradual steady decrease from max to min over the period, with an instant return to max at the end.

base

  The base value, the minimum if amplitude > 0, the maximum if amplitude < 0

frequency

  The number of wave iterations per second, i.e. speed

phase

  Offset of the wave start

amplitude

  The size of the wave

The range of the output of the wave will be {base, base+amplitude}. So the example above scales the texture in the x direction between 1 (normal size) and 5 along a sine wave at one cycle every 5 second (0.2 waves per second).

### transform

This attribute allows you to specify a static 4x4 transformation matrix for the texture unit, thus replacing the individual scroll, rotate and scale attributes mentioned above.
Note: Only applies to the fixed-function pipeline, if you're using a vertex program this will have no effect unless you use the texture_matrix auto-param.

Format: transform m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33

The indexes of the 4x4 matrix value above are expressed as m<row><col>.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by David Rogers on May, 26 2012 using texi2html 1.70.