Unreal Profiling tools and tips

Unreal Engine provides many features to visualize and track performance, we will try to cover the most relevant tracking features that answer our needs.

(Note : this document doesn't cover how to use the session frontend tool but explain how to use real time features that are more efficient and accessible for everyone)


Display console command

First thing first, in order to open the console you need to press the (~) button, you can also put a custom button by adding it in the Project Setting → Input → Console


The command line can be used in : editor / PIE(Play In Editor) / Package Development or Debug (Note : it will not work when in Shipping package)

Now that we have our console, let's take a look at the most important command line that we can use and what kind of information is displayed


Profiling Command List


Stat fps

· Frame rate : FPS

· Frame time to be rendered in milliseconde








Stat Unit and stat Unitgraph

· Frame : Milliseconde

· Game : CPU Mostly related to code, Blueprint etc

· Draw : How much time it took for CPU to prepare data for GPU

· GPU : Rendering in millisecond



Stat memory

It will display the memory taken by different parts of the game

Stat SceneRendering

Displays statistics related to the rendering of the scene, the most relevant ones would be :

  • InitViews: To do with the occlusion of the scene. While occluding the scene the hardware has to do quite a large number of checks which meshes you can and cannot see. This can end up taking a significant amount of performance.

  • Base Pass Drawing and StaticDrawList/Dynamic Primitive Drawing: The rendering of the meshes and dynamic meshes within view. If Dynamic Primitive Drawing would be very high, you would know that it is an InterpActor that is most likely causing a problem somewhere.

  • Translucency Drawing: The time spent on drawing translucent surfaces. A very high number here could indicate a problem with particles for example.



Stat GPU

Display GPU stats related to the current frame


Note : It may happen with certain graphic card that those stat won't show up if that's the case, to solve the issue you need to run the following commmands 

· r.NVIDIATimestampWorkAround=0

· r.gpustatenables=1

Stat StatSystem

Displays rendering statistics

Stat Game

Displays information related to the world such actor tick etc 

Performance tips and helpers 

Changing screen resolution

r.ScreenPercentage value (Ex.50): This command will reduce the screen resolution by the percentage amount you've set Ex. 50% will reduce your resolution to half  

r.SetRes value (Ex. 1280x720) : The command will set the screen resolution to the desired one. 

The usage of those commands can be useful when we want to investigate what would be causing a drop of framerate, or to test a scene with different settings

Potential issues and solution

Pixel bound problems : Translucent = Multiple layers of polygons are shaded, big cost, means it will renderer every object while Opaque is cheap because only the closest triangle is drawn Quad overdraw, let says a quad means 4 pixels (2 x 2) : operation are done in full quad and even bigger tiles, not on singel pixels, that why small polygon was GPU time


Triangle count is rarely the problem, from the moment that polygon are big enough and fit perfectly the shape

Vertex bound : Can be a problem when it comes to tesselation, and also affect the shadow casting

Memory related : Too many texture sample will use a lot of bandwith which represent the transfer of data from memory to the object that perform the calculation, this can be solved by compresion or Texture packing (put texture in different chanel of a single RGB texture)


Editor optimization visualizer 

Actually it's one of the most powerful feature for scene optimization, it allows you to detect the potential performance bottleneck by filtering element such as light, quad, shader etc.  


Ressources


Reading

http://vincentloignon.com/blog/optimizing-and-profiling-games-with-unreal-engine-4/

https://www.casualdistractiongames.com/single-post/2017/01/07/UE4---Overview-of-Static-Mesh-Optimization-Options

http://www.hourences.com/tutorials-ue3-performance-profiling-introduction/

https://docs.unrealengine.com/en-US/Engine/Performance/GPU/index.html

http://www.g-truc.net/post-0662.html


Youtube series 

https://tinyurl.com/y3wu5yge

That's all folks !