Graphics Performance: CPU optimization

 

To render an object to the screen, the CPU needs to do a lot of work: planning the game objects that the lighting affects, setting up the shader and shader parameters,

   sending drawing commands to the graphics driver, preparing the drawing commands to send to the graphics card.

   All these objects are resource intensive using the CPU, so if there are many visible objects, for example, there are 1000 triangular faces. then it will be easier to render with a single mesh shared on the CPU

   instead of one face per mesh (increased to 1000 meshes), on the GPU the cost for both scenarios is similar, but on the CPU Rendering 1000 objects (vs 1) is extremely expensive.

   By reducing the number of visible game objects, to reduce the workload of the CPU:

      1. Manually or use Unity's Draw Call Batching to merge (Combine) adjacent objects together.

      2. Reduce the number of materials by separating texture maps into larger texture atlas and using fewer materials.

      3. Use less objects that cause multiple renderings, such as reflections, shadows, and per-pixel lights.

   Merge objects together, each with at least a few hundred triangles, and use one Material for the entire mesh.

   Note: Merging two objects with different materials will not result in a performance gain.

   Multiple materials are only required when the two meshes do not share a texture map. To optimize CPU performance, make sure that the objects you merge share the same texture map.

   When rendering the path in the forward direction (Forward rendering path ) uses a large number of pixel lights, sometimes merging objects does not work, see Lighting performance optimization ( Lighting performance ).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326371694&siteId=291194637