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.


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.


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 参见

发表评论0条 】