[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Shadows 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.
Shadow implementations fall into basically 2 broad categories: Stencil Shadows and Texture-based Shadows. 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: Modulative Shadows, which darkens the scene in areas of shadow, and Additive Light Masking which by contrast builds up light contribution in areas which are not in shadow. You also have the option of Integrated Texture Shadows which gives you complete control over texture shadow application, allowing for complex single-pass shadowing shaders. Ogre supports all these combinations.
Shadows are disabled by default, here’s how you turn them on and configure them in the general sense:
mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
By 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:
Calling Light::setCastsShadows(false) will mean this light casts no shadows at all.
Calling Material::setReceiveShadows(false) will prevent any objects using this material from receiving shadows.
Calling MovableObject::setCastsShadows(false) will disable shadow casting for this object.
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.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on August 20, 2012 using texi2html 5.0.