Unity's optimization concepts

Source: Internet
Author: User

Modularity
Simply put, it is "Combination! Join! Join !」 (Combine! Combine! Combine !)
Mesh material may be combined, and material and texture material may be shared.
The number of surfaces used by a mesh is 1500 ~ 4000.
Only one material is recommended for one mesh.
Note: The two mesh are merged into one mesh, but using two material does not improve the efficiency.
To improve efficiency, you must combine the two mesh material into one.
In other words, a mesh uses multiple material and one material uses multiple render, which actually consumes almost the same amount of energy.
Therefore, sharing the same texture of objects is the fundamental way to improve the efficiency of objects.
Pixel light
Pixel light is very energy consuming. If you want to run very well on a computer,
You can set pixel light count to 0 in edit-> render settings. (Pixel light is not used at all)
You can also specify the importance of each light.
Set the important render mode to force pixel.
It is not important to set it to force vertex.
Layer Management
The shadows of things on the ground, such as the little rock heads or the tiles, are not clear,
We can set these things in the same region.
And use camera. layerculldistances in the script Function Change the distance between data control and display.
Function start ()
{
VaR distances = new float [32];
// Set up layer 10 to cull at 15 meters distance.
// All other layers use the far clip plane distance.
Distances [10] = 15;
Camera. layerculldistances = distances;
}
Shadow
The Shadow computation relies entirely on GPU.
Soft shadow is more efficient than hard shadow. However, the two use the same CPU as the memory.
Anti-aliasing relies entirely on GPU computing.
Anisotropic textures is based entirely on GPU calculations and is recommended for use on the ceiling or floor texture.
For more information about how to compile real-time images, please refer to the post that you posted before you are free of charge:
Http://bbs.vrsh.cn/thread-2263-1-2.html
■ Texture 2D
Unity After the PSD algorithm is used, it will automatically flatten the pipeline and won't make the pipeline larger.
The length of texture is preferably selected from the following numbers: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.
Texutre is not necessarily a square. It can also be a long square.
If the size of texture is not set by the upper number, then the structure will consume a little more memory cards, the pull time also slows down.
Therefore, the special texture size can only be used in Gui .
MIP maps
The use of MIP maps may occupy more than 33% of the memory, but the performance can be greatly improved.
We recommend that you use MIP maps for all textmaps. The only thing that is not needed is the texture of the GUI.
■ Shader efficiency (normal, transparent, transparent cutout, self-illuminated, reflective, lightmap)
From top to bottom, left to right, increasing energy consumption.
Vertex_signature-> decal
-> Diffuse fast-> diffuse detail
-> Bumped-> specular-> bumped specular
-> Parallax bumped specular
The attachment contains explicit descriptions.

 

■ Role (charcater) Optimization
1. Each mesh uses only one Skinned Mesh Renderer.
2. Do not use too many material.
The only reason you need to use different material should be that you want to use different shader.
One role uses 2 ~ 3 material should be able to replace the table Effect .
If a role may attack a weapon, the character and the material of the weapon should be separated,
Iii. Smaller bone data volume
The number of bone roles is usually between 15 and 15 ~ Generally, 30 bones can achieve good results within 60 minutes.
It is strongly suggested that the number of bones for a role should be within 30.
4. Polygon Area Data
Area data is recommended in 500 ~ 6000.
The surface Number of hl2 is 2500 ~ 5000. The number of roles in the next generation is 5000 ~ 7000.
V. Divide ik and FK into different regions
Because Unity does not need ik resources, this allows you to easily Delete ik resources.
6. Use reusable rig
In this way, different roles can use the same notebook.
7. name each bone
After each bone is named, using the ragdoll function will get twice the result with half the effort. Otherwise, it may take you a lot of time to correctly set the skeleton.
■ Original correlation
I will discuss my previous experiences and summarize them as follows:
1. biobio's new students include findobjectsoftype, findgameobjectwithtag, and gameobject. find, this type of function is very useful, but the overhead is very large. to optimize the performance, it is best to use static arraylist to store the same type of objects. It is good to query this list table when using it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.