Wow, you don’t post the easy questions do you. Ok, let’s sit down and talk frankly for a second about game engines. A Game Engine (ANY game engine) is actually merely an API, a framework for creating computer games, which themselves are nothing more than software in which artist and programmers generate a 3-dimensional real time environment using assets added from outside sources and allow end user control over a portion. From a rendering and graphical features standpoint than, any engine which utilizes the same rendering principles, shader model, and language could in fact render close to identically.
So that being said, my one big carrot to the nay-sayers, is that an engine’s rendering is only as excellent as the engineers currently writing code for it. (and to toot Epic’s horn, we have some of the best - I mean some have literally written the book on the subject - you know how annoying it is to look up an answer to a problem in a book and find the reference is the guy you could have emailed about 30 mins beforehand…, but I digress).
So to use the words of those talented engineers here goes a basic summary of the Rendering in Unreal Engine 4, if you would like to read the originals with lots of fun math there are two excellent ones, one by Brian Karis (Real Shading in Unreal Engine 4](https://www.google.com/url?q=https%3A%2F%2Fde45xmedrsdbp.cloudfront.net%2FResources%2Ffiles%2F2013SiggraphPresentationsNotes-26915738.pdf&sa=D&sntz=1&usg=AFQjCNGxI8VWCtKo-IT2NoHckvqrIMtVUQ)) and one by Martin Mittring (The Technology Behind "Unreal Engine 4 Elemental Demo"](https://www.google.com/url?q=https%3A%2F%2Fde45xmedrsdbp.cloudfront.net%2FResources%2Ffiles%2FThe_Technology_Behind_the_Elemental_Demo_16x9-1248544805.pdf&sa=D&sntz=1&usg=AFQjCNGK2LgNxs5Ivdt92E2NvWjT4Lo_9Q)). Everything that follows is a paraphrase or quote directly from these talks given above. (Note: A few quotes from Real-Time Rendering](http://www.google.com/url?q=http%3A%2F%2Fwww.realtimerendering.com%2F&sa=D&sntz=1&usg=AFQjCNGBA7r_yfWdh1hRdk-qPncwHxCBbg) by Tomas Akenine-Moeller, Eric Haines and Naty Hoffman and Brent Burley’s Physically Based Shading at Disney](http://www.google.com/url?q=http%3A%2F%2Fblog.selfshadow.com%2Fpublications%2Fs2012-shading-course%2Fburley%2Fs2012_pbs_disney_brdf_notes_v3.pdf&sa=D&sntz=1&usg=AFQjCNHIzNHoR9C0ZeV8zbIQi7_nZnO6ew) are also mixed in when needed for explication.)
To begin we need to understand the goals and principles of our Rendering Engineers when they set about to make UE4’s rendering system. These principles are extremely important as they still form the foundation of rendering in UE4. These are also directly taken from Brian Karis’ talk:
**Real-Time Performance **
[INDENT]• First and foremost, it needs to be efficient to use with many lights visible at a time.[/INDENT]
**Reduced Complexity **
[INDENT]• There should be as few parameters as possible. A large array of parameters either results in decision paralysis, trial and error, or interconnected properties that require many values to be changed for a single intended effect.
• We need to be able to use image-based lighting and analytic light sources interchangeably, so parameters must behave consistently across all light types.[/INDENT]
**Intuitive Interface **
[INDENT]• We prefer simple-to-understand values, as opposed to physical ones such as index of refraction.[/INDENT]
[INDENT]• We wish to support layering through masks, but we can only afford to shade once per pixel. This means that parameter-blended shading must match blending of the shaded results as closely as possible.[/INDENT]
Easy to Master
[INDENT]• We would like to avoid the need for technical understanding of dielectrics and conductors, as well as minimize the effort required to create basic physically plausible materials.[/INDENT]
[INDENT]• It should be difficult to mistakenly create physically implausible materials.
• All combinations of parameters should be as robust and plausible as possible.[/INDENT]
[INDENT]• Deferred shading limits the number of shading models we can have, so our base shading model needs to be descriptive enough to cover 99% of the materials that occur in the real world.
• All layerable materials need to share the same set of parameters in order to blend between them.[/INDENT]
[INDENT]• Other projects and licensees may not share the same goal of photorealism, so it needs to be flexible enough to enable non-photorealistic rendering.[/INDENT]
So there are the principles, which were used in deciding and researching the Shading, Material and Lighting Models used in UE4, but we need to look at those models in UE4 to get an idea of how these principles are implemented and ultimately how UE4 and UE3 differ.
The Shader Model
“Shading is the process of using an equation to compute the outgoing radiance . . . along the view ray . . . based on material properties and light sources” (Akenine-Möller 110). In particular most renders use a function called BDRF, or Bidirectional Reflectance Distribution Function. “As its name implies, it is a function that describes how light is reflected from a surface given two directions - The incoming light direction l and outgoing view direction v” (Akenine-Möller 223). Keep this in mind as we progress through the Shader Model and the equations will make a little more since.
To begin with Diffuse BRDF, They evaluated a few different diffuse models but in fact they had only minor differences and extra costs over the somewhat standard Lambertian Diffuse:
, where c[SUB]diff[/SUB] is the diffuse albedo (reflective color) of the material.
For the Specular BRDF, It is important to understand the Microfacet Model which, “postulates that is a surface reflection can occur between a given light vector l and view vector v, then there must exist some portion of the surface, or microfacet, with a normal aligned halfway between the l and v vectors” (Burley 1). For a visual:
It was decided to use the general Cook-Torrance Microfacet Specular shading model which states:
, where h is the half vector and n is the unit vector normal of surface
Let’s break this math up as to what each section of the equation means in terms of rendering results.
D(h) - Specular Distribution (Specular D) - The engineers went with the GGC/Trowbridge-Reitz model which was deemed worth the small extra cost over Blinn-Phong with a more distinctive “natural appearance produced by the longer ‘tail’” (Karis 3).
F(v,h) - Fresnel (Specular F) - This is the factor by which light moving between media of differing refractive indices contributes to specular reflection. Our engineers use the Schlick approximation, “…with the minor modification [of using] Spherical Approximation to replace the power” (Karis 3). This decision is a fairly typical choice with the noted exception.
G(l,v,h) - Geometric Shadowing / Attenuation (Specular G) - Here a large number of options were explored by the engineers, in which the ultimate decision to use the Schlick model with some notable and excellent modifications which I won’t get into here were made. This portion of the math contributes the self-shadowing done via the microfacets and was specifically modified to bring it in close alignment with the GGX model.
An important part of the development of the shader model was to be used with Image Based Lighting (IBL), which everyone knows in UE4, it is one of the elements which really sells the PBR. But to explain better in pictures:
This is an important distinction between UE3 and UE4. To achieve the same results, UE3 has to set up to use this via a code change and / or a material change. In UE4, this method is built as a fundamental principle of every shader.
The Material Model
The model for materials was actually “a simplification of Disney’s, with an eye towards efficiency for real-time rendering” (Karis 9). That efficiency was focused on “limiting the number of parameter . . . for optimizing G-Buffer Space, reducing texture storage and access, and minimizing the cost of blending material layers in the pixel shader” (Karis 9).
At this point in the engine development, many people are familiar to the basic material model of Base Color, Metallic, and Roughness. These form the foundation of the PBR system in UE4 and were chosen for their ease of understanding and simplicity of concept. You won’t, for instance, need to understand the difference between dielectric and conductor reflectance in metallic (Karis 9).
On of the most exciting, in my opinion, elements was the addition of Material Layering and Blending. Previously, you had “to specify material parameters individually with the values coming from textures authored for each specific model” (Karis 10). The new method however allows for reuse of material work across multiple assets, reduces the overall complexity of individual assets and unifies and centralizes the defining look of the game which makes for easier Art and Tech direction.
The Lighting Model
Although a great deal of development has been made in UE4s lighting model since inception (really that could be said for any of these sections though), the original idea was to make it more physically based which centered on improving the light fall off and “non-punctual sources of emission - commonly known as area lights” (Karis 12).
The area lights are an interesting case study and are presented quite well in both Karis’s Real Shading in UE4 and Mittring’s The Technology Behind "Unreal Engine 4 Elemental Demo.” I would do a disservice to the topic by attempting to paraphrase it, but I will just say here that the effort was put in to effectively achieve this light to best solve the physically based materials look without changing the Shader model itself which would break the idea of PBR where the shader model and material do not need to be changed based on lighting conditions.
For light falloff that means switching to the real world inverse square falloff law and using the photometric brightness unit of lumens. Ostensibly this change is fairly easy but if you know the inverse square falloff never reaches zero at any distance then you can see where the engineers had to artificially limit the light’s influence.
In short (I know too late), while UE4 grew from the kernel of methods that might have been introduced in UE3, Unreal Engine 4 is now a vast improvement over its predecessor offering more breadth and ease of use and a rendering system which is quicker, leaner and stronger.
A final note on those AAA Game companies that are using UE3 to make current gen (Xbox One, PS4) games. Chances are those same companies were very far along in the development process using UE3 when UE4 became viable to use, to warrant the cost of licensing UE4 or the time necessary to pass any original code into a new game engine. These same companies however were and are still doing similar research to methods which they are themselves adding on top of UE3 making it function closer to UE4 in methodology and practice.
Thank You -
Please read these original papers/presentations (and one book) that I have paraphrased very quickly above, they really do explain all of this stuff fairly well.
Akenine-Moeller, Tomas, Eric Haines, Naty Hoffman. Real Time Rendering, 3rd ed.](http://www.google.com/url?q=http%3A%2F%2Fwww.realtimerendering.com%2F&sa=D&sntz=1&usg=AFQjCNGBA7r_yfWdh1hRdk-qPncwHxCBbg)
Burley, Brent. Physically Based Shading at Disney](http://www.google.com/url?q=http%3A%2F%2Fblog.selfshadow.com%2Fpublications%2Fs2012-shading-course%2Fburley%2Fs2012_pbs_disney_brdf_notes_v3.pdf&sa=D&sntz=1&usg=AFQjCNHIzNHoR9C0ZeV8zbIQi7_nZnO6ew)
Karis, Brian. Real Shading in Unreal Engine 4](https://www.google.com/url?q=https%3A%2F%2Fde45xmedrsdbp.cloudfront.net%2FResources%2Ffiles%2F2013SiggraphPresentationsNotes-26915738.pdf&sa=D&sntz=1&usg=AFQjCNGxI8VWCtKo-IT2NoHckvqrIMtVUQ)
Mittring, Martin. The Technology Behind “Unreal Engine 4 Elemental Demo”](https://www.google.com/url?q=https%3A%2F%2Fde45xmedrsdbp.cloudfront.net%2FResources%2Ffiles%2FThe_Technology_Behind_the_Elemental_Demo_16x9-1248544805.pdf&sa=D&sntz=1&usg=AFQjCNGK2LgNxs5Ivdt92E2NvWjT4Lo_9Q)