[692] | 1 | <HTML> |
---|
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 3 | <!-- Created on , 12 2006 by texi2html 1.64 --> |
---|
| 4 | <!-- |
---|
| 5 | Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) |
---|
| 6 | Karl Berry <karl@freefriends.org> |
---|
| 7 | Olaf Bachmann <obachman@mathematik.uni-kl.de> |
---|
| 8 | and many others. |
---|
| 9 | Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de> |
---|
| 10 | Send bugs and suggestions to <texi2html@mathematik.uni-kl.de> |
---|
| 11 | |
---|
| 12 | --> |
---|
| 13 | <HEAD> |
---|
| 14 | <TITLE>OGRE Manual v1.2.0 ('Dagon'): Texture Units</TITLE> |
---|
| 15 | |
---|
| 16 | <META NAME="description" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Texture Units"> |
---|
| 17 | <META NAME="keywords" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Texture Units"> |
---|
| 18 | <META NAME="resource-type" CONTENT="document"> |
---|
| 19 | <META NAME="distribution" CONTENT="global"> |
---|
| 20 | <META NAME="Generator" CONTENT="texi2html 1.64"> |
---|
| 21 | <LINK TYPE="text/css" rel="stylesheet" href="../style.css"> |
---|
| 22 | </HEAD> |
---|
| 23 | |
---|
| 24 | <BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> |
---|
| 25 | |
---|
| 26 | <A NAME="SEC61"></A> |
---|
| 27 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
| 28 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_16.html#SEC35"> < </A>]</TD> |
---|
| 29 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_14.html#SEC23"> Up </A>]</TD> |
---|
| 30 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_18.html#SEC85"> > </A>]</TD> |
---|
| 31 | <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD> |
---|
| 32 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
| 33 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
| 34 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD> |
---|
| 35 | </TR></TABLE> |
---|
| 36 | <HR SIZE=1> |
---|
| 37 | <H3> 3.1.3 Texture Units </H3> |
---|
| 38 | <!--docid::SEC61::--> |
---|
| 39 | <P> |
---|
| 40 | |
---|
| 41 | Here are the attributes you can use in a 'texture_unit' section of a .material script: |
---|
| 42 | </P><P> |
---|
| 43 | |
---|
| 44 | <A NAME="SEC62"></A> |
---|
| 45 | <H2> Available Texture Layer Attributes </H2> |
---|
| 46 | <!--docid::SEC62::--> |
---|
| 47 | <UL> |
---|
| 48 | <LI> |
---|
| 49 | <A HREF="manual_17.html#SEC64">texture_alias</A> |
---|
| 50 | <LI> |
---|
| 51 | <A HREF="manual_17.html#SEC65">texture</A> |
---|
| 52 | <LI> |
---|
| 53 | <A HREF="manual_17.html#SEC66">anim_texture</A> |
---|
| 54 | <LI> |
---|
| 55 | <A HREF="manual_17.html#SEC67">cubic_texture</A> |
---|
| 56 | <LI> |
---|
| 57 | <A HREF="manual_17.html#SEC68">tex_coord_set</A> |
---|
| 58 | <LI> |
---|
| 59 | <A HREF="manual_17.html#SEC69">tex_address_mode</A> |
---|
| 60 | <LI> |
---|
| 61 | <A HREF="manual_17.html#SEC70">tex_border_colour</A> |
---|
| 62 | <LI> |
---|
| 63 | <A HREF="manual_17.html#SEC71">filtering</A> |
---|
| 64 | <LI> |
---|
| 65 | <A HREF="manual_17.html#SEC72">max_anisotropy</A> |
---|
| 66 | <LI> |
---|
| 67 | <A HREF="manual_17.html#SEC73">colour_op</A> |
---|
| 68 | <LI> |
---|
| 69 | <A HREF="manual_17.html#SEC74">colour_op_ex</A> |
---|
| 70 | <LI> |
---|
| 71 | <A HREF="manual_17.html#SEC75">colour_op_multipass_fallback</A> |
---|
| 72 | <LI> |
---|
| 73 | <A HREF="manual_17.html#SEC76">alpha_op_ex</A> |
---|
| 74 | <LI> |
---|
| 75 | <A HREF="manual_17.html#SEC77">env_map</A> |
---|
| 76 | <LI> |
---|
| 77 | <A HREF="manual_17.html#SEC78">scroll</A> |
---|
| 78 | <LI> |
---|
| 79 | <A HREF="manual_17.html#SEC79">scroll_anim</A> |
---|
| 80 | <LI> |
---|
| 81 | <A HREF="manual_17.html#SEC80">rotate</A> |
---|
| 82 | <LI> |
---|
| 83 | <A HREF="manual_17.html#SEC81">rotate_anim</A> |
---|
| 84 | <LI> |
---|
| 85 | <A HREF="manual_17.html#SEC82">scale</A> |
---|
| 86 | <LI> |
---|
| 87 | <A HREF="manual_17.html#SEC83">wave_xform</A> |
---|
| 88 | <LI> |
---|
| 89 | <A HREF="manual_17.html#SEC84">transform</A> |
---|
| 90 | </UL> |
---|
| 91 | <P> |
---|
| 92 | |
---|
| 93 | 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 <A HREF="manual_61.html#SEC263">6. External Texture Sources</A> for details. |
---|
| 94 | </P><P> |
---|
| 95 | |
---|
| 96 | <A NAME="SEC63"></A> |
---|
| 97 | <H2> Attribute Descriptions </H2> |
---|
| 98 | <!--docid::SEC63::--> |
---|
| 99 | <A NAME="texture_alias"></A> |
---|
| 100 | <A NAME="SEC64"></A> |
---|
| 101 | <H3> texture_alias </H3> |
---|
| 102 | <!--docid::SEC64::--> |
---|
| 103 | <P> |
---|
| 104 | |
---|
| 105 | Sets the alias name for this texture unit.<BR><BR> |
---|
| 106 | </P><P> |
---|
| 107 | |
---|
| 108 | Format: texture_alias <name><BR><BR> |
---|
| 109 | </P><P> |
---|
| 110 | |
---|
| 111 | Example: texture_alias NormalMap<BR><BR> |
---|
| 112 | </P><P> |
---|
| 113 | |
---|
| 114 | Setting the texture alias name is usefull if this material is to be copied by other other materials and only the textures will be changed in the new material.(See section <A HREF="manual_20.html#SEC106">3.1.6 Copying Materials</A>)<BR><BR> |
---|
| 115 | Default: If a texture_unit has a name then the texture_alias defaults to the texture_unit name. |
---|
| 116 | </P><P> |
---|
| 117 | |
---|
| 118 | <A NAME="texture"></A> |
---|
| 119 | <A NAME="SEC65"></A> |
---|
| 120 | <H3> texture </H3> |
---|
| 121 | <!--docid::SEC65::--> |
---|
| 122 | <P> |
---|
| 123 | |
---|
| 124 | Sets the name of the static texture image this layer will use.<BR><BR> |
---|
| 125 | </P><P> |
---|
| 126 | |
---|
| 127 | Format: texture <texturename> [<type>] [numMipMaps] [alpha]<BR><BR> |
---|
| 128 | </P><P> |
---|
| 129 | |
---|
| 130 | Example: texture funkywall.jpg<BR><BR> |
---|
| 131 | </P><P> |
---|
| 132 | |
---|
| 133 | 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.<BR><BR> |
---|
| 134 | 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: |
---|
| 135 | <DL COMPACT> |
---|
| 136 | <DT>1d |
---|
| 137 | <DD>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. |
---|
| 138 | <DT>2d |
---|
| 139 | <DD>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. |
---|
| 140 | <DT>3d |
---|
| 141 | <DD>A 3 dimensional texture ie 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 ie through a pixel shader. |
---|
| 142 | <DT>cubic |
---|
| 143 | <DD>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. |
---|
| 144 | </DL> |
---|
| 145 | 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.<BR><BR> |
---|
| 146 | <P> |
---|
| 147 | |
---|
| 148 | Finally, the 'alpha' option allows you to specify that a single channel (luminence) 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. |
---|
| 149 | </P><P> |
---|
| 150 | |
---|
| 151 | Default: none<BR><BR> |
---|
| 152 | </P><P> |
---|
| 153 | |
---|
| 154 | <A NAME="anim_texture"></A> |
---|
| 155 | <A NAME="SEC66"></A> |
---|
| 156 | <H3> anim_texture </H3> |
---|
| 157 | <!--docid::SEC66::--> |
---|
| 158 | <P> |
---|
| 159 | |
---|
| 160 | 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.<BR><BR> |
---|
| 161 | </P><P> |
---|
| 162 | |
---|
| 163 | Format1 (short): anim_texture <base_name> <num_frames> <duration><BR><BR> |
---|
| 164 | </P><P> |
---|
| 165 | |
---|
| 166 | Example: anim_texture flame.jpg 5 2.5<BR><BR> |
---|
| 167 | </P><P> |
---|
| 168 | |
---|
| 169 | 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.<BR><BR> |
---|
| 170 | </P><P> |
---|
| 171 | |
---|
| 172 | Format2 (long): anim_texture <frame1> <frame2> ... <duration><BR><BR> |
---|
| 173 | </P><P> |
---|
| 174 | |
---|
| 175 | Example: anim_texture flamestart.jpg flamemore.png flameagain.jpg moreflame.jpg lastflame.tga 2.5<BR><BR> |
---|
| 176 | </P><P> |
---|
| 177 | |
---|
| 178 | 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. <BR><BR> |
---|
| 179 | </P><P> |
---|
| 180 | |
---|
| 181 | Default: none<BR><BR> |
---|
| 182 | </P><P> |
---|
| 183 | |
---|
| 184 | <A NAME="cubic_texture"></A> |
---|
| 185 | <A NAME="SEC67"></A> |
---|
| 186 | <H3> cubic_texture </H3> |
---|
| 187 | <!--docid::SEC67::--> |
---|
| 188 | <P> |
---|
| 189 | |
---|
| 190 | 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.<BR><BR> |
---|
| 191 | </P><P> |
---|
| 192 | |
---|
| 193 | Format1 (short): cubic_texture <base_name> <combinedUVW|separateUV><BR><BR> |
---|
| 194 | </P><P> |
---|
| 195 | |
---|
| 196 | 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.<BR><BR> |
---|
| 197 | </P><P> |
---|
| 198 | |
---|
| 199 | Format2 (long): cubic_texture <front> <back> <left> <right> <up> <down> separateUV<BR><BR> |
---|
| 200 | </P><P> |
---|
| 201 | |
---|
| 202 | 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).<BR><BR> |
---|
| 203 | </P><P> |
---|
| 204 | |
---|
| 205 | In both cases the final parameter means the following: |
---|
| 206 | <DL COMPACT> |
---|
| 207 | <DT>combinedUVW |
---|
| 208 | <DD> 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. |
---|
| 209 | <DT>separateUV |
---|
| 210 | <DD> 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. |
---|
| 211 | </DL> |
---|
| 212 | <BR> |
---|
| 213 | Default: none |
---|
| 214 | <P> |
---|
| 215 | |
---|
| 216 | <A NAME="tex_coord_set"></A> |
---|
| 217 | <A NAME="SEC68"></A> |
---|
| 218 | <H3> tex_coord_set </H3> |
---|
| 219 | <!--docid::SEC68::--> |
---|
| 220 | <P> |
---|
| 221 | |
---|
| 222 | 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.<BR><BR> |
---|
| 223 | </P><P> |
---|
| 224 | |
---|
| 225 | Format: tex_coord_set <set_num><BR><BR> |
---|
| 226 | </P><P> |
---|
| 227 | |
---|
| 228 | Example: tex_coord_set 2<BR><BR> |
---|
| 229 | </P><P> |
---|
| 230 | |
---|
| 231 | Default: tex_coord_set 0<BR><BR> |
---|
| 232 | </P><P> |
---|
| 233 | |
---|
| 234 | <A NAME="tex_address_mode"></A> |
---|
| 235 | <A NAME="SEC69"></A> |
---|
| 236 | <H3> tex_address_mode </H3> |
---|
| 237 | <!--docid::SEC69::--> |
---|
| 238 | 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. <BR><BR> |
---|
| 239 | <P> |
---|
| 240 | |
---|
| 241 | Simple Format: tex_address_mode <uvw_mode> <BR> |
---|
| 242 | Extended Format: tex_address_mode <u_mode> <v_mode> [<w_mode>] |
---|
| 243 | <DL COMPACT> |
---|
| 244 | <DT>wrap |
---|
| 245 | <DD> Any value beyond 1.0 wraps back to 0.0. Texture is repeated. |
---|
| 246 | <DT>clamp |
---|
| 247 | <DD> 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. |
---|
| 248 | <DT>mirror |
---|
| 249 | <DD> Texture flips every boundary, meaning texture is mirrored every 1.0 u or v |
---|
| 250 | <DT>border |
---|
| 251 | <DD> Values outside the range [0.0, 1.0] are set to the border colour, you might also set the <A HREF="manual_17.html#SEC70">tex_border_colour</A> attribute too. |
---|
| 252 | </DL> |
---|
| 253 | <BR> |
---|
| 254 | Default: tex_address_mode wrap<BR><BR> |
---|
| 255 | <P> |
---|
| 256 | |
---|
| 257 | <A NAME="tex_border_colour"></A> |
---|
| 258 | <A NAME="SEC70"></A> |
---|
| 259 | <H3> tex_border_colour </H3> |
---|
| 260 | <!--docid::SEC70::--> |
---|
| 261 | <P> |
---|
| 262 | |
---|
| 263 | Sets the border colour of border texture address mode (see <A HREF="manual_17.html#SEC69">tex_address_mode</A>). <BR><BR> |
---|
| 264 | </P><P> |
---|
| 265 | |
---|
| 266 | Format: tex_border_colour <red> <green> <blue> [<alpha>]<BR> |
---|
| 267 | NB valid colour values are between 0.0 and 1.0.<BR><BR> |
---|
| 268 | </P><P> |
---|
| 269 | |
---|
| 270 | Example: tex_border_colour 0.0 1.0 0.3<BR><BR> |
---|
| 271 | </P><P> |
---|
| 272 | |
---|
| 273 | Default: tex_border_colour 0.0 0.0 0.0 1.0<BR><BR> |
---|
| 274 | </P><P> |
---|
| 275 | |
---|
| 276 | <A NAME="filtering"></A> |
---|
| 277 | <A NAME="SEC71"></A> |
---|
| 278 | <H3> filtering </H3> |
---|
| 279 | <!--docid::SEC71::--> |
---|
| 280 | <P> |
---|
| 281 | |
---|
| 282 | 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.<BR><BR> |
---|
| 283 | <STRONG>Simple Format</STRONG><BR> |
---|
| 284 | Format: filtering <none|bilinear|trilinear|anisotropic><BR> |
---|
| 285 | Default: filtering bilinear<BR><BR> |
---|
| 286 | With this format, you only need to provide a single parameter which is one of the following: |
---|
| 287 | <DL COMPACT> |
---|
| 288 | <DT>none |
---|
| 289 | <DD> No filtering or mipmapping is used. This is equivalent to the complex format 'filtering point point none'. |
---|
| 290 | <DT>bilinear |
---|
| 291 | <DD> 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'. |
---|
| 292 | <DT>trilinear |
---|
| 293 | <DD> 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'. |
---|
| 294 | <DT>anisotropic |
---|
| 295 | <DD> 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 <A HREF="manual_17.html#SEC72">max_anisotropy</A> attribute too. |
---|
| 296 | </DL> |
---|
| 297 | <BR><BR> |
---|
| 298 | <STRONG>Complex Format</STRONG><BR> |
---|
| 299 | Format: filtering <minification> <magnification> <mip><BR> |
---|
| 300 | Default: filtering linear linear point<BR><BR> |
---|
| 301 | This format gives you complete control over the minification, magnification, and mip filters. Each parameter can be one of the following: |
---|
| 302 | <DL COMPACT> |
---|
| 303 | <DT>none |
---|
| 304 | <DD> Nothing - only a valid option for the 'mip' filter , since this turns mipmapping off completely. The lowest setting for min and mag is 'point'. |
---|
| 305 | <DT>point |
---|
| 306 | <DD> Pick the closet pixel in min or mag modes. In mip mode, this picks the closet matching mipmap. |
---|
| 307 | <DT>linear |
---|
| 308 | <DD> Filter a 2x2 box of pixels around the closest one. In the 'mip' filter this enables filtering between mipmap levels. |
---|
| 309 | <DT>anisotropic |
---|
| 310 | <DD> 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 <A HREF="manual_17.html#SEC72">max_anisotropy</A> attribute too. |
---|
| 311 | </DL> |
---|
| 312 | <P> |
---|
| 313 | |
---|
| 314 | <A NAME="max_anisotropy"></A> |
---|
| 315 | <A NAME="SEC72"></A> |
---|
| 316 | <H3> max_anisotropy </H3> |
---|
| 317 | <!--docid::SEC72::--> |
---|
| 318 | <P> |
---|
| 319 | |
---|
| 320 | 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.<BR><BR> |
---|
| 321 | In order for this to be used, you have to set the minification and/or the magnification <A HREF="manual_17.html#SEC71">filtering</A> option on this texture to anisotropic. |
---|
| 322 | </P><P> |
---|
| 323 | |
---|
| 324 | Format: max_anisotropy <value><BR> |
---|
| 325 | Default: max_anisotropy 1 |
---|
| 326 | </P><P> |
---|
| 327 | |
---|
| 328 | <A NAME="colour_op"></A> |
---|
| 329 | <A NAME="SEC73"></A> |
---|
| 330 | <H3> colour_op </H3> |
---|
| 331 | <!--docid::SEC73::--> |
---|
| 332 | <P> |
---|
| 333 | |
---|
| 334 | 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).<BR><BR> |
---|
| 335 | </P><P> |
---|
| 336 | |
---|
| 337 | Format: colour_op <replace|add|modulate|alpha_blend><BR><BR> |
---|
| 338 | </P><P> |
---|
| 339 | |
---|
| 340 | 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 <A HREF="manual_17.html#SEC74">colour_op_ex</A>, but you'll either have to be sure that enough multitexturing units will be available, or you should explicitly set a fallback using <A HREF="manual_17.html#SEC75">colour_op_multipass_fallback</A>.<BR> |
---|
| 341 | <DL COMPACT> |
---|
| 342 | <DT>replace |
---|
| 343 | <DD> Replace all colour with texture with no adjustment. |
---|
| 344 | <DT>add |
---|
| 345 | <DD> Add colour components together. |
---|
| 346 | <DT>modulate |
---|
| 347 | <DD> Multiply colour components together. |
---|
| 348 | <DT>alpha_blend |
---|
| 349 | <DD> Blend based on texture alpha. |
---|
| 350 | </DL> |
---|
| 351 | <BR> |
---|
| 352 | Default: colour_op modulate |
---|
| 353 | <P> |
---|
| 354 | |
---|
| 355 | <A NAME="colour_op_ex"></A> |
---|
| 356 | <A NAME="SEC74"></A> |
---|
| 357 | <H3> colour_op_ex </H3> |
---|
| 358 | <!--docid::SEC74::--> |
---|
| 359 | <P> |
---|
| 360 | |
---|
| 361 | This is an extended version of the <A HREF="manual_17.html#SEC73">colour_op</A> 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 blendind, but you are limited to the number of texture units which are available in hardware.<BR><BR> |
---|
| 362 | </P><P> |
---|
| 363 | |
---|
| 364 | Format: colour_op_ex <operation> <source1> <source2> [<manual_factor>] [<manual_colour1>] [<manual_colour2>]<BR><BR> |
---|
| 365 | </P><P> |
---|
| 366 | |
---|
| 367 | Example colour_op_ex add_signed src_manual src_current 0.5<BR><BR> |
---|
| 368 | </P><P> |
---|
| 369 | |
---|
| 370 | See the IMPORTANT note below about the issues between mulitpass 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.<BR><BR> |
---|
| 371 | </P><P> |
---|
| 372 | |
---|
| 373 | <DL COMPACT> |
---|
| 374 | <DT>Operation options |
---|
| 375 | <DD><DL COMPACT> |
---|
| 376 | <DT>source1 |
---|
| 377 | <DD> Use source1 without modification |
---|
| 378 | <DT>source2 |
---|
| 379 | <DD> Use source2 without modification |
---|
| 380 | <DT>modulate |
---|
| 381 | <DD> Multiply source1 and source2 together. |
---|
| 382 | <DT>modulate_x2 |
---|
| 383 | <DD> Multiply source1 and source2 together, then by 2 (brightening). |
---|
| 384 | <DT>modulate_x4 |
---|
| 385 | <DD> Multiply source1 and source2 together, then by 4 (brightening). |
---|
| 386 | <DT>add |
---|
| 387 | <DD> Add source1 and source2 together. |
---|
| 388 | <DT>add_signed |
---|
| 389 | <DD> Add source1 and source2 then subtract 0.5. |
---|
| 390 | <DT>add_smooth |
---|
| 391 | <DD> Add source1 and source2, subtract the product |
---|
| 392 | <DT>subtract |
---|
| 393 | <DD> Subtract source2 from source1 |
---|
| 394 | <DT>blend_diffuse_alpha |
---|
| 395 | <DD> Use interpolated alpha value from vertices to scale source1, then add source2 scaled by (1-alpha). |
---|
| 396 | <DT>blend_texture_alpha |
---|
| 397 | <DD> As blend_diffuse_alpha but use alpha from texture |
---|
| 398 | <DT>blend_current_alpha |
---|
| 399 | <DD> As blend_diffuse_alpha but use current alpha from previous stages (same as blend_diffuse_alpha for first layer) |
---|
| 400 | <DT>blend_manual |
---|
| 401 | <DD> As blend_diffuse_alpha but use a constant manual alpha value specified in <manual> |
---|
| 402 | <DT>dotproduct |
---|
| 403 | <DD> The dot product of source1 and source2 |
---|
| 404 | <DT>blend_diffuse_colour |
---|
| 405 | <DD> Use interpolated colour value from vertices to scale source1, then add source2 scaled by (1-colour). |
---|
| 406 | </DL> |
---|
| 407 | <DT>Source1 and source2 options |
---|
| 408 | <DD><DL COMPACT> |
---|
| 409 | <DT>src_current |
---|
| 410 | <DD> The colour as built up from previous stages. |
---|
| 411 | <DT>src_texture |
---|
| 412 | <DD> The colour derived from the texture assigned to this layer. |
---|
| 413 | <DT>src_diffuse |
---|
| 414 | <DD> The interpolated diffuse colour from the vertices (same as 'src_current' for first layer). |
---|
| 415 | <DT>src_specular |
---|
| 416 | <DD> The interpolated specular colour from the vertices. |
---|
| 417 | <DT>src_manual |
---|
| 418 | <DD> The manual colour specified at the end of the command. |
---|
| 419 | </DL> |
---|
| 420 | </DL> |
---|
| 421 | <BR> |
---|
| 422 | 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. <BR><BR> |
---|
| 423 | <P> |
---|
| 424 | |
---|
| 425 | 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.<BR><BR> |
---|
| 426 | </P><P> |
---|
| 427 | |
---|
| 428 | 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.<BR><BR> |
---|
| 429 | </P><P> |
---|
| 430 | |
---|
| 431 | Default: none (colour_op modulate)<BR> |
---|
| 432 | </P><P> |
---|
| 433 | |
---|
| 434 | <A NAME="colour_op_multipass_fallback"></A> |
---|
| 435 | <A NAME="SEC75"></A> |
---|
| 436 | <H3> colour_op_multipass_fallback </H3> |
---|
| 437 | <!--docid::SEC75::--> |
---|
| 438 | <P> |
---|
| 439 | |
---|
| 440 | Sets the multipass fallback operation for this layer, if you used colour_op_ex and not enough multitexturing hardware is available.<BR><BR> |
---|
| 441 | </P><P> |
---|
| 442 | |
---|
| 443 | Format: colour_op_multipass_fallback <src_factor> <dest_factor><BR><BR> |
---|
| 444 | </P><P> |
---|
| 445 | |
---|
| 446 | Example: colour_op_mulitpass_fallback one one_minus_dest_alpha<BR><BR> |
---|
| 447 | </P><P> |
---|
| 448 | |
---|
| 449 | 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.<BR><BR> |
---|
| 450 | </P><P> |
---|
| 451 | |
---|
| 452 | 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.<BR><BR> |
---|
| 453 | </P><P> |
---|
| 454 | |
---|
| 455 | <A NAME="alpha_op_ex"></A> |
---|
| 456 | <A NAME="SEC76"></A> |
---|
| 457 | <H3> alpha_op_ex </H3> |
---|
| 458 | <!--docid::SEC76::--> |
---|
| 459 | <P> |
---|
| 460 | |
---|
| 461 | Behaves in exactly the same away as <A HREF="manual_17.html#SEC74">colour_op_ex</A> 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. |
---|
| 462 | </P><P> |
---|
| 463 | |
---|
| 464 | <A NAME="env_map"></A> |
---|
| 465 | <A NAME="SEC77"></A> |
---|
| 466 | <H3> env_map </H3> |
---|
| 467 | <!--docid::SEC77::--> |
---|
| 468 | <P> |
---|
| 469 | |
---|
| 470 | Turns on/off texture coordinate effect that makes this layer an environment map.<BR><BR> |
---|
| 471 | </P><P> |
---|
| 472 | |
---|
| 473 | Format: env_map <off|spherical|planar|cubic_reflection|cubic_normal><BR><BR> |
---|
| 474 | </P><P> |
---|
| 475 | |
---|
| 476 | 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.<BR><BR> |
---|
| 477 | <DL COMPACT> |
---|
| 478 | <DT>spherical |
---|
| 479 | <DD> 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. |
---|
| 480 | <DT>planar |
---|
| 481 | <DD> 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. |
---|
| 482 | <DT>cubic_reflection |
---|
| 483 | <DD> 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 <A HREF="manual_17.html#SEC67">cubic_texture</A> to this texture unit and use the 'combinedUVW' option. |
---|
| 484 | <DT>cubic_normal |
---|
| 485 | <DD> 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 <A HREF="manual_17.html#SEC67">cubic_texture</A> with the 'combinedUVW' option. |
---|
| 486 | |
---|
| 487 | </DL> |
---|
| 488 | <BR> |
---|
| 489 | Default: env_map off<BR> |
---|
| 490 | <P> |
---|
| 491 | |
---|
| 492 | <A NAME="scroll"></A> |
---|
| 493 | <A NAME="SEC78"></A> |
---|
| 494 | <H3> scroll </H3> |
---|
| 495 | <!--docid::SEC78::--> |
---|
| 496 | <P> |
---|
| 497 | |
---|
| 498 | Sets a fixed scroll offset for the texture.<BR><BR> |
---|
| 499 | </P><P> |
---|
| 500 | |
---|
| 501 | Format: scroll <x> <y><BR><BR> |
---|
| 502 | </P><P> |
---|
| 503 | |
---|
| 504 | 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 <A HREF="manual_17.html#SEC79">scroll_anim</A> attribute.<BR><BR> |
---|
| 505 | </P><P> |
---|
| 506 | |
---|
| 507 | <A NAME="scroll_anim"></A> |
---|
| 508 | <A NAME="SEC79"></A> |
---|
| 509 | <H3> scroll_anim </H3> |
---|
| 510 | <!--docid::SEC79::--> |
---|
| 511 | <P> |
---|
| 512 | |
---|
| 513 | 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 <A HREF="manual_17.html#SEC83">wave_xform</A>).<BR><BR> |
---|
| 514 | </P><P> |
---|
| 515 | |
---|
| 516 | Format: scroll_anim <xspeed> <yspeed><BR> |
---|
| 517 | </P><P> |
---|
| 518 | |
---|
| 519 | <A NAME="rotate"></A> |
---|
| 520 | <A NAME="SEC80"></A> |
---|
| 521 | <H3> rotate </H3> |
---|
| 522 | <!--docid::SEC80::--> |
---|
| 523 | <P> |
---|
| 524 | |
---|
| 525 | 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 <A HREF="manual_17.html#SEC81">rotate_anim</A>.<BR><BR> |
---|
| 526 | </P><P> |
---|
| 527 | |
---|
| 528 | Format: rotate <angle><BR><BR> |
---|
| 529 | </P><P> |
---|
| 530 | |
---|
| 531 | The parameter is a anticlockwise angle in degrees.<BR><BR> |
---|
| 532 | </P><P> |
---|
| 533 | |
---|
| 534 | <A NAME="rotate_anim"></A> |
---|
| 535 | <A NAME="SEC81"></A> |
---|
| 536 | <H3> rotate_anim </H3> |
---|
| 537 | <!--docid::SEC81::--> |
---|
| 538 | <P> |
---|
| 539 | |
---|
| 540 | Sets up an animated rotation effect of this layer. Useful for creating fixed-speed rotation animations (for varying speeds, see <A HREF="manual_17.html#SEC83">wave_xform</A>).<BR><BR> |
---|
| 541 | </P><P> |
---|
| 542 | |
---|
| 543 | Format: rotate_anim <revs_per_second><BR><BR> |
---|
| 544 | </P><P> |
---|
| 545 | |
---|
| 546 | The parameter is a number of anticlockwise revolutions per second.<BR><BR> |
---|
| 547 | </P><P> |
---|
| 548 | |
---|
| 549 | <A NAME="scale"></A> |
---|
| 550 | <A NAME="SEC82"></A> |
---|
| 551 | <H3> scale </H3> |
---|
| 552 | <!--docid::SEC82::--> |
---|
| 553 | <P> |
---|
| 554 | |
---|
| 555 | 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 <A HREF="manual_17.html#SEC83">wave_xform</A>.<BR><BR> |
---|
| 556 | </P><P> |
---|
| 557 | |
---|
| 558 | Format: scale <x_scale> <y_scale><BR><BR> |
---|
| 559 | </P><P> |
---|
| 560 | |
---|
| 561 | Valid scale values are greater than 0, with a scale factor of 2 making the texture twice as big in that dimension etc.<BR><BR> |
---|
| 562 | </P><P> |
---|
| 563 | |
---|
| 564 | <A NAME="wave_xform"></A> |
---|
| 565 | <A NAME="SEC83"></A> |
---|
| 566 | <H3> wave_xform </H3> |
---|
| 567 | <!--docid::SEC83::--> |
---|
| 568 | <P> |
---|
| 569 | |
---|
| 570 | 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.<BR><BR> |
---|
| 571 | </P><P> |
---|
| 572 | |
---|
| 573 | Format: wave_xform <xform_type> <wave_type> <base> <frequency> <phase> <amplitude><BR><BR> |
---|
| 574 | </P><P> |
---|
| 575 | |
---|
| 576 | Example: wave_xform scale_x sine 1.0 0.2 0.0 5.0<BR><BR> |
---|
| 577 | <DL COMPACT> |
---|
| 578 | <DT>xform_type |
---|
| 579 | <DD><DL COMPACT> |
---|
| 580 | <DT>scroll_x |
---|
| 581 | <DD> Animate the x scroll value |
---|
| 582 | <DT>scroll_y |
---|
| 583 | <DD> Animate the y scroll value |
---|
| 584 | <DT>rotate |
---|
| 585 | <DD> Animate the rotate value |
---|
| 586 | <DT>scale_x |
---|
| 587 | <DD> Animate the x scale value |
---|
| 588 | <DT>scale_y |
---|
| 589 | <DD> Animate the y scale value |
---|
| 590 | </DL> |
---|
| 591 | <DT>wave_type |
---|
| 592 | <DD><DL COMPACT> |
---|
| 593 | <DT>sine |
---|
| 594 | <DD> A typical sine wave which smoothly loops between min and max values |
---|
| 595 | <DT>triangle |
---|
| 596 | <DD> An angled wave which increases & decreases at constant speed, changing instantly at the extremes |
---|
| 597 | <DT>square |
---|
| 598 | <DD> Max for half the wavelength, min for the rest with instant transition between |
---|
| 599 | <DT>sawtooth |
---|
| 600 | <DD> Gradual steady increase from min to max over the period with an instant return to min at the end. |
---|
| 601 | <DT>inverse_sawtooth |
---|
| 602 | <DD> Gradual steady decrease from max to min over the period, with an instant return to max at the end. |
---|
| 603 | </DL> |
---|
| 604 | <DT>base |
---|
| 605 | <DD> The base value, the minimum if amplitude > 0, the maximum if amplitdue < 0 |
---|
| 606 | <DT>frequency |
---|
| 607 | <DD> The number of wave iterations per second, i.e. speed |
---|
| 608 | <DT>phase |
---|
| 609 | <DD> Offset of the wave start |
---|
| 610 | <DT>amplitude |
---|
| 611 | <DD> The size of the wave |
---|
| 612 | </DL> |
---|
| 613 | <BR> |
---|
| 614 | 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).<BR><BR> |
---|
| 615 | <P> |
---|
| 616 | |
---|
| 617 | <A NAME="transform"></A> |
---|
| 618 | <A NAME="SEC84"></A> |
---|
| 619 | <H3> transform </H3> |
---|
| 620 | <!--docid::SEC84::--> |
---|
| 621 | <P> |
---|
| 622 | |
---|
| 623 | 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. <BR><BR> |
---|
| 624 | </P><P> |
---|
| 625 | |
---|
| 626 | Format: transform m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33<BR><BR> |
---|
| 627 | </P><P> |
---|
| 628 | |
---|
| 629 | The indexes of the 4x4 matrix value above are expressed as m<row><col>. |
---|
| 630 | </P><P> |
---|
| 631 | |
---|
| 632 | <A NAME="Declaring Vertex and Fragment Programs"></A> |
---|
| 633 | <HR SIZE=1> |
---|
| 634 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
| 635 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_16.html#SEC35"> < </A>]</TD> |
---|
| 636 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_14.html#SEC23"> Up </A>]</TD> |
---|
| 637 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_18.html#SEC85"> > </A>]</TD> |
---|
| 638 | <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD> |
---|
| 639 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
| 640 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
| 641 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD> |
---|
| 642 | </TR></TABLE> |
---|
| 643 | <BR> |
---|
| 644 | <FONT SIZE="-1"> |
---|
| 645 | This document was generated |
---|
| 646 | by <I>Steve Streeting</I> on <I>, 12 2006</I> |
---|
| 647 | using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html |
---|
| 648 | "><I>texi2html</I></A> |
---|
| 649 | |
---|
| 650 | </BODY> |
---|
| 651 | </HTML> |
---|