UE4 Performance Optimization Method (Tool article)

Source: Internet
Author: User

This article is based on UE4 official documents and official blog summary, may not be comprehensive, will be added later. Please refer to the official documentation for a detailed description of the built-in tools.

The game frame rate is very low, or there is a lag phenomenon, there may be many reasons, this time do not guess, such as is not too many people or rendering too many things, so guess the meaning is not big, may waste a lot of time, but always find a point, of course, if the luck can also find bottlenecks, At this point we can use the appropriate tools to find performance bottlenecks. Here we only use the UE4 to unfold the explanation.

First to determine the bottleneck is the CPU or GPU, in order to find who, in a non-debug version of your program, and enter the Stat Unit command on the console, if it is on the Android platform can simultaneously press four fingers, open the console, enter the stat unit, It will appear as shown in the following:

Frame time is the total time it takes to produce a frame, because the logical thread (GAME) and the render thread (Draw) need to be synchronized at the end of a frame, and the time spent in a frame is often similar to one of the lines thread. GPU Time measures the time it takes for the graphics card to render the current scene. Since the GPU time is synchronized with the current frame, it takes roughly the same time as a frame.

If a frame spends more time than the logical thread, then the bottleneck is in the logical thread, but the bottleneck is in the render thread if it is closer to the time of the render thread. If the two time is not close, but with the GPU time is close, then the bottleneck on the video card.

Of course, you can also use some third-party tools, such as Intel Vtume, Aqtime, etc., on the mobile platform can use the Apple Instruments, NVIDIA Tegra System Profiler, ARM DS-5 and so on.

Bottlenecks in Logical threads

A performance analysis can be used to determine that by opening the console, enter "Stat startfile" and let it run at least 10s to get a multi-frame average. If it is too long, the resulting file will be very large. End performance analysis with stat Stopfile. A file with the suffix ue4stats will be generated under the project path, and if it is Android, it will generate a profile directory under the directory you installed. If you want to view the results of the analysis, you must copy the file to the PC, you can use the ADB pull {ue4stats full path} {PC save path} to copy files to the PC.

At this point you can use Unrealfrontend (with Ue4editor in the sibling directory) to open the results of the analysis, or in Ue4edtior through window-->developper ToolsàSession Frontend, open and switch to the profiler panel, and load to open the Ue4stats file.

When you open it, you can check the time-consuming area yourself.

If you want to see the stutter, you can see the peaks in the timeline by selecting maximum instead of average, so it shows some spikes as shown.

GPU Analytics

If you can use the PROFILEGPU command on a PC platform or use the shortcut key ctrl+shift+,

You can also use some third-party tools to test on PC platforms such as Intel GPA, nvidia nsight Visual Studio Edition, mobile platforms such as Qualcomm's Adreno Profiler, nvidia Tegra Graphics Debugger, Imgtec Pvrtune and Pvrtrace, ARM Mali Graphics Debugger, and so on, Apple's Xcode can be used for analysis.

Some of the common commands
    • Stat Unit

    • Stat scenerendering

    • Stat engine

    • Stat Initviews

    • Stat Game

    • Stat Slow

    • ViewMode shadercomplexity
    • Stat Unitgraph

      The complete Stat command Reference https://docs.unrealengine.com/latest/CHN/Engine/Performance/StatCommands/index.html.

Some of the most useful variables for analysis:

  • R.setres Change the screen, or the resolution of the window.
  • R.vsync on/Off vertical sync (may depend on whether native full screen).
  • The r.screenpercentage is used to reduce the actual rendering resolution inside, and the screen is re-amplified.
  • The r.allowocclusionqueries is used to disable occlusion (which allows the scene to run slower).
  • R.tileddeferredshading can turn off Tile-based delayed lighting technology (GPU particles have no return method for light and shadow).
  • R.tileddeferredshading.minimumcount can adjust how many lights are applied to the Tile-based delayed lighting technology (there is no visual difference but the performance will vary).
  • Pause pauses the game or Matinee (the analysis is more stable, but Update/tick is disabled).
  • The Slomo can speed up or slow down the game.
  • R.visualizeoccludedprimitives Displays the outer box of the clipped object.
  • Startfpschart Stopfpschart please see below.
  • R.separatetranslucency This is a feature for repairing the problem of depth of field in semitransparent situations, and can be turned off if not needed, and has other effects (check scenecolor).
  • R.tonemapper.grainquantization is used to turn off the noise added in Tonemapper to avoid Color banding, because 8bit quantization and minor quality improvements are not required for the output to be 10:10:10.
  • R.scenecolorformat can choose from a variety of scenecolor formats (default is the best quality of 64bit, and support screen space sub-surface scattering).
  • Fx. Allowgpusorting disables particle sorting (which can be used in a large number of particles).
  • Fx. Freezeparticlesimulation prohibits the updating of particles.
  • R.SSR. Maxroughness adjusts the maximum size of the screen space Reflection (SSR) and overwrites this setting in post-processing. Please refer to Show Flag VISUALIZESSR.
Command-Line Options

Some features can be closed on the command line, such as Ue4.exe–nosound

Some of the more useful switches for analysis are:

    • -nosound disables sound and music systems.
    • -notexturestreaming
    • Turn off decal steaming (useful for isolating problems).
    • -NOVERIFYGC Otherwise, you expect performance fluctuations that you will encounter every 30 seconds in the release release.
    • -novsync can render faster but can cause tearing, especially at high frames.
    • -streaming is useful for using Startfpschart/stopfpschart to get data from a non-Windows device and for further testing (assuming we are real-time cook data).

UE4 Performance Optimization Method (Tool article)

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.