English

ogre 3d 1.7 beginner’s guide 第三章 第六小节 中文翻译 添加阴影

2011/2/28

Adding shadows

【 添加阴影 】

Without shadows, a 3D scene isn't really complete; so let's add them.

【 一个没有阴影的3D场景不是真正完整的3D场景。因此,让我们添加它们 】

Time for action – adding shadows

【 实践时刻 】

Use the previously used code.

【 使用之前已使用过的代码】

1.  After adding all the other code in the createScene() function, add the

following line:

【 1. 在createScene() 函数中现存的代码之后添加以下一行:】

mSceneMgr->setShadowTechnique(Ogre:: SHADOWTYPE_STENCIL_ADDITIVE);

    • Compile and run the application.

【 2. 编译运行程序。】

What just happened?

【 刚刚发生了什么?】

With just one line, we added shadows to our scene. Ogre 3D does the rest of the work

for us. Ogre 3D supports different shadow techniques. We used additive stencil shadows.

Stencil means a special texture buffer used while rendering the scene.

【 用了刚才的一行代码,我们添加阴影到我们的场景之中。Ogre 3D为我们做了在剩下的工作。Ogre 3D 支持不同的阴影技术。我们使用了additive stencil shadows。Stencil 意思是指,当渲染场景时,使用的一种特殊的纹理缓冲。】

Additive implies that the scene is rendered once from the camera perspective and the contribution of each light is accumulated into the final render. This technique creates good results but is also really expensive because each light adds another rendering run. We won't go into details on how shadows work because this is a complex field. Many books could be written about this topic, and also, shadow techniques change rapidly and are heavily researched. If you are interested in this topic, you can find interesting articles in the NVIDIA book series GPU Gems, the ShaderX book series, and in the proceedings of the Siggraph conference (http://www.siggraph.org/).

【Additive意味着场景在画面视角中渲染一次并且每个光源的效果积累为最终的渲染效果。这种技术产生了很好的效果,但是却付出了昂贵的代价。因为每添加一个光源,另一个渲染就会运转。我们不能深入细节讨论这种阴影的工作原理是什么,因为这实在是一个很复杂的领域。有很多关于这个专题的书籍,而且,阴影的技术在快速改变并且它被人们大量的研究。如果你对这个专题很感兴趣。你可以寻找关于NVIDIA的有关 GPU的宝石系列丛书或ShaderX系列丛书中有意义的文章或者寻找Siggraph(计算机图形图像特别兴趣小组)的会议记录(http://www.siggraph.org/)。】