Unity3D高级手册0600:优化图形性能

2014-09-01 21:21:20|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:游戏, 虚拟现实, Unity3D|来源:唯设编程网

Pixel lights 像素光源

If you use pixel lighting, then each GameObject has to be rendered as many times as there are pixel lights that affect the object. If you combine two objects that are very far apart, it might increase the size of the object and now you have a lot of lights affecting this big object. If your objects were separate however, the light wouldn't have to be applied on the part of the mesh which is far away. This can result in rendering the combined mesh as many times as the uncombined mesh thus you didn't save anything. For this reason, you should keep GameObjects that are very far away as individual Meshes.

如果你使用像素光源,那么每个GameObject要尽可能多的时间有响的对象的像素光源被渲染。如果你组合的两个对象是非常遥远,它可能会增加对象的大小而且现在你有许多光源影响这个大的对象。然而如果你的对象是分开的,光源将不必对遥远网格的一部分应用。这可能导致渲染的未结合的网格多次联合网格,因此你有保存任何东西。为此,你应该保持GameObjects是很遥远的个人网格。

When rendering a mesh, Unity finds all lights surrounding the mesh. It then figures out what lights affect the mesh the most. The Edit->Render Settings are used to modify how many of the lights end up as pixel lights and how many as vertex lights.

当渲染网格,Unity发现所有的光源周围的网格。然后它估算出是什么光源影响网格最大。Edit->Render Settings用来修改多少光源作为像素光源结束和多少光源作为顶点光源结束。

Every light calculates its importance based on how far away it is from the mesh and how intense it is.

每一个光源计算它自己的重要性基于它是距离网格多远和它是多么激烈的(光源亮度的激烈程度)。

Some lights are more important than others depending on the game context. For this reason, every light has a Render Mode setting which can be set to Force Pixel or Force Vertex.

有些光源重要性超过其它光源,依据游戏的上下文。因为这个理由,每一个光源有一个染模式设置,可被设置强制像素光源或强制顶点光源。

Imagine the player's car with head lights driving through the night. The head light is the most important light in the game. For this reason, the head lights Render Mode should be set to Force Pixel.

设想玩家通过夜间驾驶的汽车的头灯光。头灯光是游戏中最重要的光。因为这个理由,头灯光渲染模式应设置为强制像素。

If you have a light that isn't very important and also visually doesn't gain much from being a pixel light, set the lights Render Mode to "Force Vertex". This way you don't waste rendering performance or lose any visual quality.

如果你有一个不是很重要光并且也不能获得视觉上从一个像素的很多光线,设置灯光渲染模式为强制顶点。这样,你就不会浪费的渲染性能或损失任何视觉质量。

Per-layer cull distances每一层精选距离

You might want to cull small objects earlier to reduce number of draw calls. For example, small rocks and debris could be made invisible at much smaller distance than large buildings. To do that, put small objects into a separate layer and setup per-layer cull distances using Camera.layerCullDistances script function.

你可能想精选早期小对象减少绘制调用的数量。例如,小石头和瓦砾应能在更小的距离超过无形的大型建筑物。要做到这一点,放入一个单独的层和设置每层精选距离使用Camera.layerCullDistances脚本函数。

Shadows 阴影

Shadows are generally expensive. They can add a lot of performance overhead to your game if they are not used correctly. For more details about shadows, please read the Shadows page.

阴影一般昂贵。如果没有正确使用阴影,它们可以添加大量的性能开销到以你的游戏。有关阴影详细信息,请阅读阴影页面。

See Also 参见

<12>
发表评论0条 】
网友评论(共?条评论)..
Unity3D高级手册0600:优化图形性能