Monday 11 September 2017

Deferred and Forward Rendering in Unreal Engine 4

This is my first post here! So I've decided to do a short research-overview of two popular rendering techniques using the scene from "Infinity Blade: Glass Lands" environment by Epic Games.

Courtesy of Epic Games

You won't find anything specifically new here, just a comparison between two rendering algorithms in a modern scene that is actually meant to be playable. What I mean is that in theory we all know pros and cons of Deferred and Forward Rendering, but what about a real situation? So let's figure it out!

Everyone who is familiar with Deferred Rendering knows that it allows you to render multiple lights by gathering information with one geometry pass into the G-Buffer. Unfortunately, it has some common problems with complex BRDF models, anti-aliasing and transparency. (There're solutions, of course, but sometimes they aren't super-efficient.)

Normal Buffer

Forward Rendering is another technique that is less popular these days, but isn't obsolete at all. Well, it has issues with rendering multiple lights because of the way this algorithm works (although there're solutions, too, such as Forward+, for example), but at the same time it can easily handle MSAA. 

By default, UE4 uses Deferred Rendering, but you can switch to Forward as well. Forward Rendering is popular for developing VR projects, although it isn't fully optimized yet. For instance, Screen Space Techniques (SSR, SSAO) aren't supported in UE4 at the moment of writing this post. 

So let's take a look at a non-VR environment and compare the perfomance with in-built GPU Profiling. In addition, I should mention that I'm using Unreal Engine 4.16 version (Shader Model 5) and NVIDIA GeForce GTX 850m with Intel Core i5 4200m for the specs.

First of all, I will check the basics - frame rate. Deferred Rendering gives us about 18ms (~55 FPS), whereas Forward Rendering shows ~16ms (~62 FPS). The difference is not gigantic, but it is noticable. To be more specific:

Forward Rendering

Deferred Rendering

Of course, for delving into details let's check out both "Scene Rendering" commands:

Deferred Rendering

Forward Rendering
So as we can see there are some ms differences (i.e "Translucency drawing") in rendering with both techniques. I have to admit that the scene that I took for this research gives higher perfomance with Forward Rendering, even though in some other circumstances (light complexity and etc.) the situation might be completely different!

All I wanted to say is that we should not consider one or another technique old or useless in the modern video game development. We have to wisely choose the most suitable algorithm for our demands (AA or something else) or even combine both of them! (This is a common practice these days.) Anyway, there are many topics to learn and discover, such as Clustered Shading, Tiled Shading and etc.

Links: