Ogre Reference Manual (iii) 3.1.3 Texture Unit Textureunit

Source: Internet
Author: User
Tags border color

3.1.3 Texture Units Texture Unit

The texture unit is set through the Texture_unit segment in the. Material script

Texture_alias

To set a texture cell alias, for example:

Texture_unit Diffuse//texture unit name

{

Texture_alias Diffusemap//aliases

Tex_address_mode Clamp

}

Texture

Set up a static texture map used by the texture layer

Format: Texture <texturefile> [<type>[unlimited | nummipmaps][alpha][<pixelformat>][gamma]

This setting is mutually exclusive to the anim_texture (animated texture). Note: The texture file name Texturefile parameter cannot contain spaces.

The type defaults to ' 2d ' and includes the following types:

1d one-dimensional texture, that is, the texture is only one pixel high. Most likely to be used in fragment shaders to encode functions into one-dimensional textures for simple lookups. If the shader uses one-dimensional texture coordinates and you need to use this type, GL requires that the texture texture type match the coordinates (D3D not required). Based on performance and compatibility considerations, the texture width should be 2 times the number of points

2d default type, texture width is better than 2 of the number of times, the use of squares on most hardware to perform best

3d three-dimensional texture-body texture with width, height and depth of three coordinates

The Cubic cube consists of 6 pairs of 2d textures affixed to the inner surface of the cube. can be accessed through 3d texture coordinates, which is useful for cube maps and normal graphs.

The NUMMIPMAPS option defines the number of mipmaps the texture generates. The default unlimited indicates that it has been generated to the 1*1 size. Note: If you use the same texture in more than one material, the number of mipmaps generated depends on the texture setting you first resolved to

The alpha option is used to indicate that a single-channel (Luma luminance) texture is loaded as an alpha channel, rather than the default red channel (the channel). Suitable for use in fixed pipelines with a texture that contains only alpha values

The PixelFormat option specifies the pixel format of the texture, which can be different from the pixel format loaded in the file. The final pixel format may be limited by hardware compatibility. The available options are:

Pf_l8 8-bit brightness, pf_l16 16-bit brightness, pf_a8 8-bit alpha, PF_DXT1 DDS DXT1 format, etc...

The gamma option indicates that you want a gamma correction of the texture value when the graphics hardware is sampled, only if the texture has a 8-bit color channel (for example: PF_R8G8B8). Typically, a texture of 8bit per channel is always stored in the gamma space to increase the precision of the dark color, but this leads to mixing and filtering calculation problems because these assume a linear color space. For best color quality, hardware automatically converts texture values to linear space during texture sampling, and then makes reliable linear calculations in pipelines. When rendered to the 8bit channel display, then back to the gamma space, which can be processed in the shader (by raising to the power 1/2.2) or by enabling the rendering texture or gamma correction of the render window. Note: The gamma option only uses the settings at the time of the first load, and is consistent when multiple places are shared.

Anim_texture

Sets the image as a dynamic texture layer. The dynamic texture layer implies that it contains multiple frames, each frame being a different picture file. Options are available in two formats, one that directly specifies a picture name and an implied file name.

Format 1:anim_texture <frame1> <frame2>...<duration>

Specify multiple picture names and the total duration, duration 0 means not to automatically switch frames, requiring manual control of the Code

Format 2:anim_texture <base_name> <num_frames> <duration>

Example: Anim_texture flame.jpg 5 2.5

will automatically load five frames, the corresponding file name is flame_0.jpg, Flame_1.jpg,... flame_4.jpg, duration 2.5 seconds (2fps).

Cubic_texture

Sets the picture used by the cube texture. A cube consisting of 6 separate polygons. Can be used for reflection graphs (if the hardware supports cube mapping) or Sky boxes. There are two formats, an implied file name, a direct designation of 6 picture names

Format 1:cubic_texture <base_name> <COMBINEDUVW | Separateuv>

If Base_name is ' skybox.jpg ', then auto-load skybox_fr.jpg, skybox_bk.jpg, Skybox_up.jpg, Skybox_dn.jpg, skybox_lf.jpg, and Skybox_ Rt.jpg (up and down) six files.

Format 2:cubic_texture up and down around SPEARATEUV

Directly specify the six texture picture file names before and after the top and bottom, and only use the SEPARATEUV option

COMBINEDUVW 6 Textures form a single cube texture and are accessed through the U v w 3d texture coordinates. This option must be used as a reflection diagram. Note: Not all graphics cards support cube textures

SEPARATEUV 6 textures are still separated from each other, with only one texture active (setcurrentframe) at a time, still using the 2d texture coordinate index. More suitable for Sky boxes, because only one polygon is rendered at a time and is available on the old graphics card.

Note: Textures are referenced by textureunitstate::setcurrentframe, and the sky box actually replicates 6 copies of the material, each binding a different texture frame.

Binding_type

To set a texture cell to bind to a vertex or pixel shader

Format: Binding_type <vertex|fragment>, default fragment

Content_Type

Specifies how the texture cell gets the data, which is loaded by default by name (typically a file name). can also be set to get from an automatic data source

Format: Content_Type <named|shadow|compositor> [<ref compositor name>] [<ref Texture Name>] [< Referenced MRT index>], default named,

Description

Named default mode, depending on the file or manually specify the name

Shadow uses a shaded texture when used to customize the texture shadow of the order. The texture depends on the order of the nearest light shadow (the first texture in the same channel refers to the nearest light shadow, and the second is the second near light). ), or recursion based on the starting light order set by the channel iteration or Light_start option. The different channel indexes are reset to 0 to support texture multiple use (e.g. separate specular/gloss channels). With this option, the light projection matrix is set automatically if the line is fixed, and if the shader is used, it can be obtained by Texture_viewproj_matrix automatic parameters.

Compositor refers to the synth texture, which is valid only in the synthesizer render sequence: through the render_scene directive of the synthesizer, or through a normal channel connected to the viewport of the synthesizer. Note that the texture shadows do not change the rendering order, so ensure a reasonable reference order (the texture's co-use may cause its reference to be overwritten). Additional parameters are used for this option:

Compositorname the name of the synthesizer referenced

TextureName the referenced texture name

MRT Index Texture index for MRT (multi-render target, multiple render targets), optional

Example: Content_Type compositor depthcompositor outputtexture

Tex_coord_set

Sets the set of texture coordinates used. Mesh mesh to define multiple sets of texture coordinates

Format: Tex_coord_set <int>, default 0

Tex_address_mode

Defines how the texture coordinates are addressed when they exceed 1.0. You can specify the same way with one parameter, or use three different values

Format: Text_address_mode <uvw_mode> or <u_mode> <v_mode> [<w_mode>]

Mode parameter Description:

Wrap overlaps, over 1.0 back to 0, texture repeatedly tiled, default way

Clamp clamping, more than 1.0 as 1.0 treatment. When used to require precise 0-1.0 texture coordinates, the wrap pattern filter is avoided to produce blurred boundaries

Mirror mirroring mode

Border more than 0-1.0 parts with border color, reference tex_border_colour

Tex_border_colour

Set texture boundary color

Format: Tex_border_colour <red > <green> <blue> [<alpha>]

Filtering

Set the filter mode when the texture is zoomed out, in two formats, one predefined single-parameter format, and the other specifying amplification, shrinking, and MIP filtering

Format 1:filtering <minification> <magnification> <mip>, default filtering linear linear point

None is used only for MIP parameters and is used to turn off mipmap. Zoom out minimum configuration to point

Point is used to zoom in and out to indicate selection of the nearest pixel, which means selecting the most matching mipmap for MIP

Linear 2*2 box-type filtration. Used for MIP when using adjacent two mipmap filters

Anisotropic anisotropy, only zooming in and out of use, compensating for filtering based on the slope of the camera space (more pixels in the inclined direction). To avoid tilting the angle of view is too vague, note: You need to set max_anisotropy

Format 2:filtering <none|bilinear|trilinear|anisotropic>, default bilinear, which is linear linear point

None no filter, do not use mipmap. Equivalent to ' filtering point point none '

Bilinear bilinear filter, recently mipmap. Equivalent to ' filtering linear linear point '.

Trilinear three linear filtration, equivalent to ' filtering linear linear linear '.

Anisotropic anisotropy, equivalent to ' filtering anisotropic anisotropic linear '

Max_anisotropy

Sets the maximum compensation multiplier that filtering uses when zooming in and out using anisotropic. The anisotropic multiplier refers to the height of the visible texture fragment on the screen space divided by the number of widths visible, the greater the angle of the ramp (if you look vertically at a wall multiple of 1:1). Set to greater than 1 to achieve compensation. The maximum value is determined by the hardware, typically 8 or 16.

Format: max_anisotropy <int>, default 1

Mipmap_bias

Sets the offset of the mipmap calculation. Hardware support mipmap offset required.

Format: Mipmap_bias <float>, default 0

Colour_op

Defines how the current texture layer blends with the previous texture layer (in the case of the first texture layer, which is how the light is blended, that is, how the first texture layer blends with the vertex color. The results of blending all texture layers are then mixed with pass settings and existing rendered scenes. For fixed rendering pipelines

Format: Colour_op <replace|add|modulate|alpha_blend>, default modulate

There are several predefined ways that you can automatically set up two blending methods: one for supporting single-channel multi-texture hardware, and one for multi-channel degraded rendering settings (Ogre Auto-implementation) that do not support single-channel multi-texture hardware. Better results with finer colour_op_ex, but if you're unsure whether your hardware supports single-channel multi-textures, you'll need to manually set up Colour_op_multipass_fallback to control degraded multi-channel rendering

Note: Colour_op only sets the color blending method, alpha is mixed by default by modulate, and the alpha blending method needs to be modified by ALPHA_OP_EX

Colour_op_ex

Extended version of multi-texture color blending settings, hardware that supports multi-texture blending can achieve more complex blending operations than multi-channel blending, but the number of supported texture units is limited by hardware. For fixed rendering pipelines

Usage: colour_op_ex <operation> <source1> <source2> [<manual_alpha>] [<manual_colour1>] [ <manual_colour2>]

operation Mixing mode:

Source1\source2, using Source1 or, source2, equivalent to scene_blend one zero or zero one of the channels

Example: COLOUR_OP_EX source2 src_texture src_current//with current value (not updated)

The Modulate\molulate_x2\modulate_x4 product method, Source1*source2, because the default two textures modulate darken the scene (unlike alpha blending), so provide _x2\_ X4 Two ways of highlighting (when mixed results are dimmed), indicating source1*source2*2 or source1*source2*4, (_x2\_x4 mode has no corresponding multi-channel degradation implementation)

Example: COLOUR_OP_EX modulate_x2 src_texture src_current//using a mix of twice times as the final result

Source1 Hybrid Source 1,

Add summation and

addsigned accumulation and-0.5 cases: colour_op_ex add_signed src_texture src_current

Add_smooth Accumulation and-product

Substract minus: Source1-source2

Blend_diffuse_alpha using vertex alpha blending (DIFFUSE.A * source1 + (1-DIFFUSE.A) *source2)

Blend_diffuse_colour using color blending (similar to pass color_blend)

Blend_texture_alpha using texture alpha blending

Blend_current_alpha using the current alpha value blend (the alpha value of the previous texture stage, the result is the same as blend_diffuse_alpha for the first texture layer)

Example: COLOUR_OP_EX blend_texture_alpha src_texture src_current

Blend_manual is similar to Blend_diffuse_alpha, except that the alpha value specified with the Manual_alpha parameter

Example: COLOUR_OP_EX blend_manual src_texture src_current 0.9//Mix the current texture by alpha value 0.9

Dotproduct dot product? (The dot product of Source1 and Source2)

source1\source2 Mixed Source:

Src_current Texture Stage Blending color (for first texture layer, equivalent to src_diffuse)

Src_texture the current texture

Src_diffuse Vertex Color

Src_specular Vertex Specular color

Src_manual Manually specifying colors

Example: COLOUR_OP_EX add src_current src_manual 0 1 0//Add green (r G B) to previous blend results

(Note: There is no two src_manual color value, and of course it doesn't make sense)

Note: When using src_texture, it should be set to the first parameter, such as: COLOUR_OP_EX add src_texture src_current, should not use COLOUR_OP_EX add Src_current src_texture, To prevent certain APIs (Direct3D) from being supported

With COLOUR_OP_EX and ALPHA_OP_EX, you can achieve very powerful blending without shaders, which are beyond the functionality supported by multi-channel rendering, and when the hardware does not support multiple textures or the number of textures is too high, you need to use the Colour_op_multipass_ Fallback sets the degraded multi-Channel rendering method (poor effect, slow speed).

When blending in modulate mode, because the color range is (0-1), the product makes the result darker, and all modulate_x2\_x4 is a common method.

COLOUR_OP_EX only sets the color blending method, alpha is mixed by default by modulate, and ALPHA_OP_EX is required to modify the alpha blending method.

Colour_op_multipass_fallback

Multi-texture blending with COLOUR_OP_EX settings does not automatically degrade to multi-channel rendering, it is unclear whether the hardware can support multi-texture rendering, it is necessary to use this statement to set a more close multi-channel rendering mode.

Usage: colour_op_multipass_fallback <src_factor> <dest_factor>

Similar to Scene_blend, example: Colour_op_multipass_fallback one One_minus_dest_alpha

Alpha_op_ex

Multi-texture alpha blending mode settings

Usage: alpha_op_ex <operation> <source1> <source2> [<manual_factor>] [<manual_alpha1>] [ <manual_ Alpha2>]

Similar to COLOUR_OP_EX, the difference is that Manual_colour is a set of three floating-point numbers, Manual_alpha is a single floating-point number

Example: ALPHA_OP_EX modulate_x4 src_texture src_current//Transparency Press 4 times times modulate mix

Env_map

Turn texture environment map effect on/off

Format: Env_map <off|spherical|planar|cubic_reflection|cubic_normal>, default off, turn off environment map

The environment map automatically generates texture coordinates based on the relative relationships of object vertices, normals, and viewpoints to make the object appear reflective.

Spherical spherical environment map. A single texture that needs to be made using a fisheye lens to reflect the scene, or other textures that appear to be suitable for spherical maps (smooth, highlighted textures are especially suitable for car simulations). The effect relies on the angle of view and the vertex normals of the object, which works best when the object has many smooth normals, i.e. curved objects

Planar planar map. Similar to spherical, the difference is that the effect is based on the vertex position in the viewport instead of the vertex normals. The effect is suitable for planar geometry (spherical environment maps do not fit in this case, because the normals are the same) or there is no normal condition.

Cubic_refection uses six textures to implement a cube reflection map, which works fine in all cases, but requires more hardware support than a spherical map. You need to use the COMBINEDUVW option in the Cubic_texture configuration.

Cubic_normal generating 3D texture coordinates based on camera space normals computed from vertex normals information

Scroll

Sets the texture offset. For fixing pipelines

Format: Scroll <x> <y>

Use to adjust texture coordinates while avoiding changing model texture coordinates. If you need a dynamic scrolling effect, use the Scroll_anim

Scroll_anim

Set the fixed speed scrolling effect (change speed using Wave_xform)

Format: Scroll_anim <xspeed> <yspeed>

Rotate

Rotates the texture by the specified angle

Format: rotate <angle>, angle to counterclockwise degrees

Rotate_anim

Set rotation angle per second

Format: Rotate_anim <angle>

Scale

Scaling

Scale <x_scale> <y_scale>

Wave_xform

The dynamic texture transformation is set through the waveform function. Multiple transformations can be superimposed on a texture layer

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 Transform type: scroll_x,scroll_y,rotate,scale_x,scale_y

Wave_type waveform: sine sine, triangle triangle, Square Square, Sawtooth Sawtooth, inverse_sawtooth anti-aliasing

Base base value, amplitude>0 for minimum value, maximum when amplitude<0

Frequency frequency

Phase Waveform Start Offset

Amplitude amplitude (can be negative)

Transform

The texture transformation is set by the 4*4 matrix, replacing the Scroll\rotate\scale attributes mentioned above

Format: Transform m00 m01 m02 m03 M10 M11 M12 M13 M20 m21 M22 M23 M30 M31 M32 M33

Ogre Reference Manual (iii) 3.1.3 Texture Unit Textureunit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.