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.0.7: Techniques</TITLE> |
---|
15 | |
---|
16 | <META NAME="description" CONTENT="OGRE Manual v1.0.7: Techniques"> |
---|
17 | <META NAME="keywords" CONTENT="OGRE Manual v1.0.7: Techniques"> |
---|
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="SEC31"></A> |
---|
27 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
28 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_15.html#SEC24"> < </A>]</TD> |
---|
29 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_15.html#SEC24"> Up </A>]</TD> |
---|
30 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_17.html#SEC34"> > </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.1 Techniques </H3> |
---|
38 | <!--docid::SEC31::--> |
---|
39 | <P> |
---|
40 | |
---|
41 | A "technique" section in your material script encapsulates a single method of rendering an object. The simplest of material definitions only contains a single technique, however since PC hardware varies quite greatly in it's capabilities, you can only do this if you are sure that every card for which you intend to target your application will support the capabilities which your technique requires. In addition, it can be useful to define simpler ways to render a material if you wish to use material LOD, such that more distant objects use a simpler, less performance-hungry technique.<BR><BR> |
---|
42 | </P><P> |
---|
43 | |
---|
44 | When a material is used for the first time, it is 'compiled'. That involves scanning the techniques which have been defined, and marking which of them are supportable using the current rendering API and graphics card. If no techniques are supportable, your material will render as blank white. The compilation examines a number of things, such as: |
---|
45 | <UL> |
---|
46 | <LI>The number of texture_unit entries in each pass<BR> |
---|
47 | Note that if the number of texture_unit entries exceeds the number of texture units in the current graphics card, the technique may still be supportable so long as a fragment program is not being used. In this case, Ogre will split the pass which has too many entries into multiple passes for the less capable card, and the multitexture blend will be turned into a multipass blend (See section <A HREF="manual_18.html#SEC66">colour_op_multipass_fallback</A>). |
---|
48 | <LI>Whether vertex or fragment programs are used, and if so which syntax they use (e.g. vs_1_1, ps_2_x, arbfp1 etc) |
---|
49 | <LI>Other effects like cube mapping and dot3 blending |
---|
50 | </UL> |
---|
51 | <BR> |
---|
52 | In a material script, techniques must be listed in order of preference, i.e. the earlier techniques are preferred over the later techniques. This normally means you will list your most advanced, most demanding techniques first in the script, and list fallbacks afterwards.<BR><BR> |
---|
53 | <P> |
---|
54 | |
---|
55 | Techniques have only one attribute of their own, which indicates which LOD index they belong to (See section <A HREF="manual_16.html#SEC32">lod_index</A>). We also mention an extra Material attribute called <A HREF="manual_16.html#lod_distances">lod_distances</A> which isn't a Technique attribute but is directly related to the lod_index attribute, so it's listed here for convenience.<BR><BR> |
---|
56 | </P><P> |
---|
57 | |
---|
58 | <A NAME="lod_index"></A> |
---|
59 | <A NAME="SEC32"></A> |
---|
60 | <H3> lod_index </H3> |
---|
61 | <!--docid::SEC32::--> |
---|
62 | <P> |
---|
63 | |
---|
64 | Sets the level-of-detail (LOD) index this Technique belongs to. <BR><BR> |
---|
65 | </P><P> |
---|
66 | |
---|
67 | Format: lod_index <number><BR> |
---|
68 | NB Valid values are 0 (highest level of detail) to 65535, although this is unlikely. You should not leave gaps in the LOD indexes between Techniques.<BR><BR> |
---|
69 | </P><P> |
---|
70 | |
---|
71 | Example: lod_index 1<BR><BR> |
---|
72 | </P><P> |
---|
73 | |
---|
74 | All techniques must belong to a LOD index, by default they all belong to index 0, ie the highest LOD. Increasing indexes denote lower levels of detail. You can (and often will) assign more than one technique to the same LOD index, what this means is that OGRE will pick the best technique of the ones listed at the same LOD index. For readability, it is advised that you list your techniques in order of LOD, then in order of preference, although the latter is the only prerequisite (OGRE determines which one is 'best' by which one is listed first). You must always have at least one Technique at lod_index 0.<BR><BR> |
---|
75 | The distance at which a LOD level is applied is determined by the lod_distances attribute of the containing material, See section <A HREF="manual_16.html#lod_distances">lod_distances</A> for details.<BR><BR> |
---|
76 | </P><P> |
---|
77 | |
---|
78 | Default: lod_index 0<BR><BR> |
---|
79 | </P><P> |
---|
80 | |
---|
81 | <A NAME="lod_distances"></A> |
---|
82 | <A NAME="SEC33"></A> |
---|
83 | <H3> lod_distances </H3> |
---|
84 | <!--docid::SEC33::--> |
---|
85 | <STRONG>Note: this attribute must be specified in the outer material section (ie the parent of all the techniques), but it's specified here since it is most relevant to this section.</STRONG><BR><BR> |
---|
86 | <P> |
---|
87 | |
---|
88 | By setting this attribute, you indicate that you want this material to alter the Technique that it uses based on distance from the camera. You must give it a list of distances, in ascending order, each one indicating the distance at which the material will switch to the next LOD. Implicitly, all materials activate LOD index 0 for distances less than the smallest of these. You must ensure that there is at least one Technique with a <A HREF="manual_16.html#SEC32">lod_index</A> value for each distance in the list (so if you specify 3 distances, you must have techniques for indexes 1, 2 and 3). Note you must always have at least one Technique at lod_index 0.<BR><BR> |
---|
89 | </P><P> |
---|
90 | |
---|
91 | Format: lod_distances <distance_1> [<distance_2> ... <distance_n>]<BR> |
---|
92 | </P><P> |
---|
93 | |
---|
94 | Example: lod_distances 300.0 600.5 1200<BR><BR> |
---|
95 | </P><P> |
---|
96 | |
---|
97 | The above example would cause the material to use the best Technique at lod_index 0 up to a distance of 300 world units, the best from lod_index 1 from 300 up to 600, lod_index 2 from 600 to 1200, and lod_index 3 from 1200 upwards.<BR><BR> |
---|
98 | </P><P> |
---|
99 | |
---|
100 | Techniques also contain one or more passes (and there must be at least one), See section <A HREF="manual_17.html#SEC34">3.1.2 Passes</A>. |
---|
101 | </P><P> |
---|
102 | |
---|
103 | <A NAME="Passes"></A> |
---|
104 | <HR SIZE=1> |
---|
105 | <TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> |
---|
106 | <TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_15.html#SEC24"> < </A>]</TD> |
---|
107 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_15.html#SEC24"> Up </A>]</TD> |
---|
108 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_17.html#SEC34"> > </A>]</TD> |
---|
109 | <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> |
---|
110 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD> |
---|
111 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD> |
---|
112 | <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD> |
---|
113 | </TR></TABLE> |
---|
114 | <BR> |
---|
115 | <FONT SIZE="-1"> |
---|
116 | This document was generated |
---|
117 | by <I>Steve Streeting</I> on <I>, 12 2006</I> |
---|
118 | using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html |
---|
119 | "><I>texi2html</I></A> |
---|
120 | |
---|
121 | </BODY> |
---|
122 | </HTML> |
---|