Common Causes of Bad Framerate in Student Environments

 

KNOWLEDGE IS POWER

Or put another way, without knowing the cause of your framerate issues, you will be stabbing the dark, throwing away heaps of time making “optimisations” which make no significant impact on your framerate.

Incidentally, this is a good read: https://docs.unrealengine.com/latest/INT/Engine/Rendering/PerformanceProfiling/Guidelines/index.html

 

IDENTIFY WHAT

  1. Turn on a framerate counter if you have not already done so. If your engine doesn’t have one, use FRAPS.
  2. Turn layers off and on to see which assets are affecting your framerate most.
  3. Try and pinpoint it to a specific asset if you can. The table below is sorted by likelihood, so this can give you a clue where to start looking.

 

UNDERSTAND WHY

Use the table below to figure out the reason that asset is hurting your framerate. Understand what is written. Google if the description is not sufficient.

 

APPLY RESOLUTION

Now we know what is hurting our frame rate and why, the resolution is usually simple. Apply the proper resolution. Profit.

 

Issue  Description  Common Causes / Diagnosis  Resolution 
Overdraw When a single screen pixel has to be drawn many times. This can occur from bad sorting, or more typically from blend transparency 
  • Foliage (including grass)
  • large-particle VFX like smoke
  • Diagnose: apply an opaque shader to your VFX or blend assets

 

  • Favour fewer, more opaque particles
  • Favour alpha test (stencil) where possible
  • Use extra geometry to keep blend geometry tight around the visible part of the texture

 

Expensive dynamic lighting  In deferred lighting, each light has to essentially “overdraw” onto each screen pixel.In forward lighting, each light has to draw once per object it hits

 

  • Large, overlapping lights
  • Many dynamic shadowcasting lights
  • Diagnose: disable shadowcasting or disable lights entirely

 

  • Only use shadowcasters where needed
  • Ensure shadow map resolution is only as big as needed
  • Favour smaller lights with sharper falloff
  • If your engine lets you exclude small objects from shadowmap rendering, do this

 

Fill rate bound (shader cost)  Bulk of a frame is usually spent “colouring in” your pixels. This is a factor of the time it takes for your shader to be computer per pixel. This is usually a result of too many texture samples. 
  • Usually too many texture samples
  • Diagnose: Throw a single-colour shader on the “problem assets” and check framerate
  • Diagnose: Fill the screen with your suspected “problem asset”. it should be worst when filling the screen.

 

  • Use as few texture samples as reasonably possible
  • If using multiple same-UV greyscale masks, instead use a multi-channel mask
  • Consider a shader LOD for things like offset/parallax

 

Transform-bound (geometry cost)  If calculating the position of mesh vertices is taking longer than filling the pixels they pertain to, you are transform-bound. 
  • Usually because of poor LODs
  • Diagnose: Halve frame resolution (ex. 1920×1080 to 1280×720). If framerate is nowhere near doubled, could be this.

 

  • Use LODs (important in large levels or “vistas”)
  • Favour static meshes over skinned ones
  • Use a cheaper vertex shader
  • Reduce geometry

 

Out of memory  If you are out of memory, your engine may try and cope. Coping measures are usually crippling to performance. In other cases, your game will simply crash. 
  • Usually asset textures
  • Sometimes lightmap textures in a big level.
  • Diagnose: Use engine profiling tools to identify what is eating up your memory

 

  • Reduce asset texture resolution, compensate using shared tiling detail textures
  • Reduce lightmap resolution (if applicable).
  • Don’t bother reducing geometry, cube map resolution, shadowmap resolutions (these rarely use much texture memory)