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

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

adding ogre 1.2 and dependencies

Line 
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'): Shadows</TITLE>
15
16<META NAME="description" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Shadows">
17<META NAME="keywords" CONTENT="OGRE Manual v1.2.0 ('Dagon'): Shadows">
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="SEC270"></A>
27<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
28<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_61.html#SEC263"> &lt; </A>]</TD>
29<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top"> Up </A>]</TD>
30<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_63.html#SEC273"> &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<H1> 7. Shadows </H1>
38<!--docid::SEC270::-->
39Shadows are clearly an important part of rendering a believable scene - they provide a more tangible feel to the objects in the scene, and aid the viewer in understanding the spatial relationship between objects. Unfortunately, shadows are also one of the most challenging aspects of 3D rendering, and they are still very much an active area of research. Whilst there are many techniques to render shadows, none is perfect and they all come with advantages and disadvantages. For this reason, Ogre provides multiple shadow implementations, with plenty of configuration settings, so you can choose which technique is most appropriate for your scene.<BR><BR>
40<P>
41
42Shadow implementations fall into basically 2 broad categories: <A HREF="manual_63.html#SEC273">7.1 Stencil Shadows</A> and <A HREF="manual_64.html#SEC280">7.2 Texture-based Shadows</A>. This describes the method by which the shape of the shadow is generated. In addition, there is more than one way to render the shadow into the scene: <A HREF="manual_65.html#SEC291">7.3 Modulative Shadows</A>, which darkens the scene in areas of shadow, and <A HREF="manual_66.html#SEC293">7.4 Additive Light Masking</A> which by contrast builds up light contribution in areas which are not in shadow. Ogre supports all these combinations.<BR><BR>
43</P><P>
44
45<A NAME="SEC271"></A>
46<H3> Enabling shadows </H3>
47<!--docid::SEC271::-->
48Shadows are disabled by default, here's how you turn them on and configure them in the general sense:
49<OL>
50<LI>
51Enable a shadow technique on the SceneManager as the <STRONG>first</STRONG> thing you doin your scene setup. It is important that this is done first because the shadow technique can alter the way meshes are loaded. Here's an example:
52<TABLE><tr><td>&nbsp;</td><td class=example><pre>mSceneMgr-&#62;setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
53</pre></td></tr></table><LI>
54Create one or more lights. Note that not all light types are necessarily supported by all shadow techniques, you should check the sections about each technique to check. Note that if certain lights should not cast shadows, you can turn that off by calling setCastShadows(false) on the light, the default is true.
55<LI>
56Disable shadow casting on objects which should not cast shadows. Call setCastShadows(false) on objects you don't want to cast shadows, the default for all objects is to cast shadows.
57<LI>
58Configure shadow far distance. You can limit the distance at which shadows are considered for performance reasons, by calling SceneManager::setShadowFarDistance.
59<LI>
60Turn off the receipt of shadows on materials that should not receive them. You can turn off the receipt of shadows (note, not the casting of shadows - that is done per-object) by calling Material::setReceiveShadows or using the receive_shadows material attribute. This is useful for materials which should be considered self-illuminated for example. Note that transparent materials are typically excluded from receiving and casting shadows, although see the <A HREF="manual_14.html#SEC29">transparency_casts_shadows</A> option for exceptions.
61</OL>
62<P>
63
64<A NAME="SEC272"></A>
65<H3> Opting out of shadows </H3>
66<!--docid::SEC272::-->
67By default Ogre treats all non-transparent objects as shadow casters and receivers (depending on the shadow technique they may not be able to be both at once, check the docs for your chosen technique first). You can disable shadows in various ways:
68<DL COMPACT>
69<DT>Turning off shadow casting on the light
70<DD>Calling Light::setCastsShadows(false) will mean this light casts no shadows at all.
71<DT>Turn off shadow receipt on a material
72<DD>Calling Material::setReceiveShadows(false) will prevent any objects using this material from receiving shadows.
73<DT>Turn off shadow casting on individual objects
74<DD>Calling MovableObject::setCastsShadows(false) will disable shadow casting for this object.
75<DT>Turn off shadows on an entire rendering queue group
76<DD>Calling RenderQueueGroup::setShadowsEnabled(false) will turn off both shadow casting and receiving on an entire rendering queue group. This is useful because Ogre has to do light setup tasks per group in order to preserve the inter-group ordering. Ogre automatically disables shadows on a number of groups automatically, such as RENDER_QUEUE_BACKGROUND, RENDER_QUEUE_OVERLAY, RENDER_QUEUE_SKIES_EARLY and RENDER_QUEUE_SKIES_LATE. If you choose to use more rendering queues (and by default, you won't be using any more than this plus the 'standard' queue, so ignore this if you don't know what it means!), be aware that each one can incur a light setup cost, and you should disable shadows on the additional ones you use if you can.
77</DL>
78<P>
79
80<A NAME="Stencil Shadows"></A>
81<HR SIZE=1>
82<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
83<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_61.html#SEC263"> &lt; </A>]</TD>
84<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top"> Up </A>]</TD>
85<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_63.html#SEC273"> &gt; </A>]</TD>
86<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>
87<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_toc.html#SEC_Contents">Contents</A>]</TD>
88<TD VALIGN="MIDDLE" ALIGN="LEFT">[Index]</TD>
89<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="manual_abt.html#SEC_About"> ? </A>]</TD>
90</TR></TABLE>
91<BR> 
92<FONT SIZE="-1">
93This document was generated
94by <I>Steve Streeting</I> on <I>, 12 2006</I>
95using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
96"><I>texi2html</I></A>
97
98</BODY>
99</HTML>
Note: See TracBrowser for help on using the repository browser.