source: OGRE/trunk/ogrenew/Docs/manual/manual_15.html @ 692

Revision 692, 9.7 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

RevLine 
[692]1<HTML>
2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3<!-- Created on , 12 2006 by texi2html 1.64 -->
4<!--
5Written 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.
9Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
10Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
11 
12-->
13<HEAD>
14<TITLE>OGRE Manual v1.2.0 ('Dagon'): Techniques</TITLE>
15
16<META NAME="description" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Techniques">
17<META NAME="keywords" CONTENT="OGRE Manual v1.2.0 ('Dagon'): 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_14.html#SEC23"> &lt; </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_16.html#SEC35"> &gt; </A>]</TD>
31<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <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
41A "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
44When 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>
47Note 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_17.html#SEC75">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>
52In 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
55To help clearly identify what each technique is used for, the technique can be named but its optional.  Techniques not named within the script will take on a name that is the technique index number.  For example: the first technique in a material is index 0, its name would be "0" if it was not given a name in the script.  The technique name must be unqiue within the material or else the final technique is the resulting merge of all techniques with the same name in the material.  A warning message is posted in the Ogre.log if this occurs.  Named techniques can help when copying a material and modifying an existing technique: (See section <A HREF="manual_20.html#SEC106">3.1.6 Copying Materials</A>)<BR><BR>
56</P><P>
57
58Format: technique name<BR><BR>
59</P><P>
60
61Techniques have only a small number of attributes of their own, the 'scheme'(See section <A HREF="manual_15.html#SEC32">scheme</A>)  they belong to, and the LOD index within that scheme (See section <A HREF="manual_15.html#SEC33">lod_index</A>). We also mention an extra Material attribute called <A HREF="manual_15.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>
62</P><P>
63
64<A NAME="scheme"></A>
65<A NAME="SEC32"></A>
66<H3> scheme </H3>
67<!--docid::SEC32::-->
68<P>
69
70Sets the 'scheme' this Technique belongs to. Material schemes are used to control top-level switching from one set of techniques to another. For example, you might use this to define 'high', 'medium' and 'low' complexity levels on materials to allow a user to pick a performance / quality ratio. Another possibility is that you have a fully HDR-enabled pipeline for top machines, rendering all objects using unclamped shaders, and a simpler pipeline for others; this can be implemented using schemes. The active scheme is typically controlled at a viewport level, and the active one defaults to 'Default'.<BR><BR>
71</P><P>
72
73Format: scheme &#60;name&#62;<BR>
74Example: scheme hdr<BR>
75Default: scheme Default<BR><BR>
76</P><P>
77
78<A NAME="lod_index"></A>
79<A NAME="SEC33"></A>
80<H3> lod_index </H3>
81<!--docid::SEC33::-->
82<P>
83
84Sets the level-of-detail (LOD) index this Technique belongs to. <BR><BR>
85</P><P>
86
87Format: lod_index &#60;number&#62;<BR>
88NB 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>
89</P><P>
90
91Example: lod_index 1<BR><BR>
92</P><P>
93
94All 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>
95The distance at which a LOD level is applied is determined by the lod_distances attribute of the containing material, See section <A HREF="manual_15.html#lod_distances">lod_distances</A> for details.<BR><BR>
96</P><P>
97
98Default: lod_index 0<BR><BR>
99</P><P>
100
101<A NAME="lod_distances"></A>
102<A NAME="SEC34"></A>
103<H3> lod_distances  </H3>
104<!--docid::SEC34::-->
105<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>
106<P>
107
108By 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_15.html#SEC33">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>
109</P><P>
110
111Format: lod_distances &#60;distance_1&#62; [&#60;distance_2&#62; ... &#60;distance_n&#62;]<BR>
112</P><P>
113
114Example: lod_distances 300.0 600.5 1200<BR><BR>
115</P><P>
116
117The 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>
118</P><P>
119
120Techniques also contain one or more passes (and there must be at least one), See section <A HREF="manual_16.html#SEC35">3.1.2 Passes</A>.
121</P><P>
122
123<A NAME="Passes"></A>
124<HR SIZE=1>
125<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
126<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_14.html#SEC23"> &lt; </A>]</TD>
127<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_14.html#SEC23"> Up </A>]</TD>
128<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_16.html#SEC35"> &gt; </A>]</TD>
129<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
130<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD>
131<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
132<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD>
133</TR></TABLE>
134<BR> 
135<FONT SIZE="-1">
136This document was generated
137by <I>Steve Streeting</I> on <I>, 12 2006</I>
138using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
139"><I>texi2html</I></A>
140
141</BODY>
142</HTML>
Note: See TracBrowser for help on using the repository browser.