[UE4] Optimization Guide (the program)

  1. GPUProfile time performance statistics to consumption, is not very accurate in the editor mode, because the editor consumption also enumerated, and if you do, preferably in Game mode to view.
  2. UE4 does not support 640X480 resolution, if you run the program under this resolution will cause the program to crash (version 4.4, the latest version of I do not know whether there is still the problem).
  3. If the character who has a lot Component needs Attach, as far as possible in the use of Attach, do a load on all attach, or when the scene in many roles, there will be a serious performance problem.
    For example: There are hundreds of characters in the scene, but not every character needs a camera and a spring arm, then do not create the camera and spring arm assemblies in the constructor.
  4. Sides UE4 insensitive, even in the mobile terminal. On ipad 4, 50 million for triangles, it is possible to stabilize operation of the frame rate to 30fps, the mobile terminal mainly Map Size, complexity of the material is sensitive.
  5. When the terrain editing, use Instanced Static Meshes. Intancing will increase the cost of the GPU, but can significantly reduce the CPU overhead. Note: Instancing does not reduce the number of CPU draw call, to reduce the number of draw call, need to reduce the types of materials, provide material reuse rate.
  6. C++ 比 蓝图快100到1000倍
    [Test] Blueprint vs C++ Performance vs Nativized BP
    https://www.reddit.com/r/unrealengine/comments/6qtxy3/test_blueprint_vs_c_performance_vs_nativized_bp/
  7. Open Occlusion Culling (Project Settings -> Engine -> Rendering -> Occlusion Culling, is turned on by default). If you need to strengthen the occlusion culling efforts (at the cost of excluding results were unexpected) to improve rendering efficiency, increase the following property values:
    Min Screen Lights for the Radius
    Min Screen Early the Z-Pass for the Radius
    Min Screen the Radius for Cascaded Shadow Maps

Lighting optimization

  1. Activity of three light consumption from low to high:
    directional light / parallel light (Directional Light) <point light source (Point Light) <spotlight (Spot Light).
    This standard is not limited to UE4, other engines as well. When the number of light sources in the scene reaches a certain magnitude, the performance gap between the three kinds of light it is on the order of the gap.
  2. When constructing light map, if the scene does not give Lightmass Importance Volume, would do the whole scene samples indirect lighting, produce Indirect Lighting Cache, which scenario for the big game is quite a waste, like a game character can not get in, vision Indirect lighting Cache need not be generated, this time can be inserted in the scene Lightmass Importance Volume, Indirect lighting Cache will produce a specific area specified, saving a lot of time to construct the illumination.
  3. Point light source and try not to turn the spotlight Cast Volumetric Shadow. After the opening performance of consumption is not open to three times the performance of consumption.
  4. If the open volume of the fog, the recommended static light into the light, so that when Build Lighting precomputed generated fog volume data, the volume of which can significantly improve the performance of mist. Volume fogging properties huge consumption.

Shadow optimization

  1. If a Stationary Directional Light, the scene when a large number of units, be sure to turn on Dynamic Shadow Distance StationaryLight(the default is 0, meaning closed).
    Test: Actor with the screen 500, camera height 4000, DirectionalLight attribute Dynamic Shadow Distance StationaryLightvalue is greater than the linear distance from the camera to the Actor (Note: is the linear distance of each Actor, so far as possible to the value set larger than 5000) otherwise, the frame rate dropped from 200 fps to 100 fps.
    Dynamic Shadow Distance StationaryLightThe reason can improve performance after opening:
    Dynamic Shadow Distance StationaryLight indicate how much the use of dynamic shadows in the distance, over this distance than the static Fade into shadow, and the shadow of Fate into a static after you can improve performance

Material optimization

  1. Material type of performance, from fast to slow: Opaque -> Masked -> Translucent.
  2. If the scene had a lot of units, such as 500, these units must be done material LOD, and remove as much of translucent materials (such as direct remove the translucent effect in the last two stages), otherwise the performance of consumption is growing exponentially.

Performance Guidelines for Artists and Designers
https://docs.unrealengine.com/latest/INT/Engine/Performance/Guidelines/

Physics and collision optimization

  1. BoxComponent the Generate Overlap Events is set to false. If you do not Overlap event, then the property is set to false, default is true. When BoxCompont reach a certain order of magnitude, open Generate Overlap Events consumption is twice the performance under the closed case.
  2. If no physical, will  Simulate Physics set to false.
  3. If you do not Hit event,  Simulation Generates Hit Events set to false.
  4. If the objects in the scene type (WorldStatic, WorldDynamic, Pawn etc.) a lot, and the number of each lot, the Object Response Collision of the better channel settings, the channel may be provided Ignore Ignore are set to. If the type of objects in the scene is relatively simple, even though this type of objects in the scene have hundreds, Object Response Block or even set to the Overlap, it has no effect on performance.
  5. If large-scale RTS game, the scene when there is a mass units (such as large-scale StarCraft 2 Zerg puppy), the Collision UE4 can not not use Collision, otherwise the number of frames slumped.
    Own proposals to achieve a simple custom Collision, Collision such as spherical, then calculates the linear distance between the unit and the Collision to determine whether whether a collision, and reduce the detection interval, such as 0.1 second.

Animation Optimization

  1. Open the role blueprint - "MeshComponent -" under Optimization category in the Detail panel - "check  Enable Update Rate Optimizations.
  2. Tick and RefreshBoneTransforms performed only for rendering SkinnedMesh
    USkinnedMeshComponent :: MeshComponentUpdateFlag = OnlyTickPoseWhenRendered;
    by default AlwaysTickPoseAndRefreshBones, regardless of whether the representation is rendered (in the visible region), perform Tick and RefreshBoneTransforms.
    The old version MeshComponentUpdateFlagis called SkinnedMeshUpdateFlag.

    If you turn off the animation Tick, Tick and associated logic will fail, for example Transform (Modify) Bone.
  3. Animated blueprint of logic try to directly access member variables, the engine is enabled by default optimization options: member variables animated blueprint is copied to Native Code at compile time, so as to avoid entering the blueprint for the virtual machine (Blueprint Virtual Machine) at runtime execution blueprint Code, because of the low blueprint VM operating efficiency.
    The default is compiled optimized parameter types include:
    Member the Variables;
    Negated boolean Member the Variables;
    Members of A nested Structure;
    specific instructions, see the official documentation:
    Animation Optimization
    https://docs.unrealengine.com/en-us/Engine/Animation/ Optimization
    Animation Fast Path Optimization
    https://docs.unrealengine.com/en-us/Engine/Animation/Optimization/FastPath

UI optimization

  1. HUD can be resolved not use UMG, wait until you need to create a Widget display objects, the destruction is not displayed, consume huge performance when more UMG object.
    For example, there is a scene within one thousand units, each unit is created for WidgetComponent, even if they do not show anything WidgetComponent, GPU will have a huge overhead.

Epic Games engineers share: How do UI optimized for UE4 on a mobile platform?
http://youxiputao.com/articles/11743

Optimization of displacement

  1. The Pawn mass (such as 500) mobile units, if it is used in a mobile AddMovementInput Tick, the halved frame rate directly (such as down from 90 to 40 multiframe). For the unit can not be moved, it is best to stop execution AddMovementInput (), in order to improve performance.

Special effects Optimization

  1. Try not to use Volume domain, will significantly increase the GPU overhead after use. Can  profilegpu detect Volume overhead.

AI Optimization

  1. If the role does not require Controller, do not give it Spawn Controller. If a character for a long time to stop, then give him Unpossesed() until the moveable again PossessedBy().
    Test: 500 characters, AI Controller Class set: null, AIController, PlayerController frames were 120 fps, 100 fps, 75 fps .

Dedicated Server Optimization

  1. Peel animation data server Cook
    Project Settings -> Engine -> Animation -> Check Strip Animation Data on Dedicated Server.
    If you added Notify Event trigger modify the data in the animation, check this option there will be problems. Make sure that the animation mounted Notify only performance-related, not involved in the game logic.
  2. Disable Server role under physical simulation mode
    FBodyInstance->bSimulatePhysics is set to false. The default is false.
    SkeletalMeshComponent::bEnablePhysicsOnDedicatedServer Set to false, default is true. But this will lead to physical checking with clients prevail, there is the risk of plug-hack. bEnablePhysicsOnDedicatedServer at run-time changes do not take effect.
  3. Disable Collision Under Server mode
    UPrimitiveComponent->bGenerateOverlapEvents set to false, the role blueprint CollisionComponent default is true.
  4. Detach the decorative role of the body all the components under Server mode

Reference material

Achieve good performance and high-quality visual effects in UE4 by optimizing
http://gad.qq.com/program/translateview/7160166

CPU Profiling
https://docs.unrealengine.com/en-us/Engine/Performance/CPU

GPU Profiling
https://docs.unrealengine.com/en-us/Engine/Performance/GPU

 

 

Transfer from https://blog.csdn.net/SUKHOI27SMK/article/details/86590795

 

Guess you like

Origin blog.csdn.net/zhangxiaofan666/article/details/96463419