War Thunder background
Physically based rendering – Dagor Engine 4.0 in War Thunder
Attention! Outdated news format. Content may not display correctly.

We’ve always paid special attention to the visual aspect of War Thunder. Even now you can see that all the models of vehicles and items in the surroundings consist of various materials and look completely distinct. Here’s the P-51D-5. Its beautiful unpainted aluminum covering brightly shines in the sunlight. Here’s the GAZ MM with 25 mm anti-air cannon, with its green paint weakly shimmering in the light. And here’s a wooden box attached to the left side of a Pz.IVG.

image
image
image

Very soon, we will introduce a new graphical technology to the game. This technology will make the graphics in War Thunder even more realistic and beautiful. Meet Physically Based Rendering – physically correct image rendering.

How do the visual special effects of a film differ from a scene render in the game? How much time is needed in order to get a realistic image in the conditions of constantly changing asynchronous events? These questions will be asked by any player who tries to imagine an instant of a battle in War Thunder: a multitude of objects, light sources, reflections and effects. In this article, we’ll tell you about a new rendering method based on the laws of physics, and also about lighting and materials.

 

 

 

Attention! This is relatively serious article and we recommend you continue reading only if you are interested in modern computer visualization technology.

 

PBR - Physically Based Rendering

The Physically Based Rendering (PBR) technology is based on the same principles and laws of physics by which light moves around in our world.

When we talk about materials, we mean that each of them has its own characteristics which affect the diffusion and reflection of light on it. As an example – a smooth sheet of paper.

Visually, it seems as if this surface is perfectly flat, but if we look at it through a microscope, we see a number of wood fibers criss-crossing each other.

When they collide with such an uneven surface, photons of light reflect from these varying wood fibers at different angles. Most of the light disperses without grouping at a single point.

However, you can imagine how many materials, along with light reflected off them, appear every second on your monitor in a War Thunder battle.

Calculating lighting with such a high level of detail isn’t possible even with offline film-rendering technology, and its structure is too complex. This is precisely why certain necessary statistical parameters of materials are used, such as roughness, refraction index, metallicity (the proportion of dielectric/conductor in a pixel).

This means that as early as the stage of creating models and their corresponding materials, we can work with the physical values of those materials. We can take into account the combinations of the required parameters without subsequent adjustment after the scene is ready.

Bi-directional Reflection Distribution Function

The bidirectional reflection distribution function (BRDF) is a four-dimensional function that defines how light reflects off an opaque surface. It also provides a means to calculate the amount of energy reflected or diffused toward an observer with a given amount of incoming emission. It’s logical that metallic, cloth or wooden surfaces in the game affect lighting, diffusion, refraction and reflection to different extents.

image
image
image
image

For this kind of calculation, we use the mathematical model Microfacet Theory, which represents the surface as a number of microfacets oriented in different directions. At the same time, each of these microfacets reflects light at an equal angle. To calculate the lighting at a specific point, we need to calculate the sum of the light reflected by the microfacets.

Note: The Cook–Torrance light reflection function. l is the direction of light. v is the direction of the observer’s vision. n is the surface normal. h is the vector between the vectors l and v (half vector). D(h) is the microfacet distribution function. F(v,h) is the Fresnel function. G(l, v, h) is the microfacet shading function. All the parameters of this function are quite simple and make physical sense. But what physical sense does the half vector make? The half vector is necessary for filtering out those microfacets that contribute to light reflection for the observer. If the microfacet’s normal is equal to the half vector, that means this microfacet contributes to lighting when the view direction is V.

The radical departure from classic rendering is that in PBR, all the surfaces – be they metals, dielectrics, vegetation and so on – are calculated according to a single physical model. As a result, the image becomes a whole and the probability of lighting errors practically disappears. On the whole, creating the material parameters is more difficult than drawing classic textures. The artists must not create what the eye sees or what is visible on photographs, but rather the physical properties of the surface. In War Thunder’s case, the artists have to alter all the textures and materials to work with the new model. But this means we can make our graphics as realistic and cohesive as possible.

Several key functions play a role in rendering the final image. Here’s some info about a few of them:

The microfacet reflection distribution D(h) provides a means to give a percentage of energy for which light reflection and energy distribution occurs depending on how smooth or rough the surface is. In War Thunder, the so-called GGX model is used.

The microfacet self-shading distribution G(l,v,h) defines how much (with slanting reflection angles) the surface shades itself. The game uses Smith’s self-shading function adapted for the GGX model (Eric Heitz. “Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs”.)

The Fresnel function F(v,h) defines the intensity of a reflected and refracted electromagnetic wave when it passes through the border between two environments. This effect is very noticeable on water. If you look at the water’s surface at a sharp angle, the water reflects the majority of the light and we see a reflection. If, on the other hand, you look at the water from a bird’s-eye view, we see practically no reflection – instead, we see what is on the bottom.

image

For opaque surfaces, the physical process is exactly the same, but the unreflected light will be diffused or absorbed.

Thanks to this function, light reflection changes based on the collision angle for various materials with various refraction indexes (the Fresnel function is actually complex, and for metals it also has both an imaginary component and is different for different wavelengths. This is why metals have colored reflection). This is particularly noticeable on expansive tank locations where there are practically no dark areas – the light everywhere has a realistic and varied structure. “In the shade” there are actually also reflected light specks. Those are light reflecting off the sky and other surfaces. Only a crevice, hole or crack is a truly “dark object” – almost none of the light that lands there is reflected.  The game uses Schlick’s approximation of Fresnel function for dielectrics, which has been used for a long time in games and films.

Light diffusion

Apart from reflecting, light on dielectrics also diffuses.

Previously, the game used the Lambert model, which, although simple, does not allow for adjusting the illumination of light diffusion from rough surfaces, of which there are many in the game. The problem is that for rough surfaces, light diffusion depends on the positions of the surface and the observer – this is precisely the reason why, for example, the moon in the sky has practically no soft shading at the terminator. Since then, we’ve moved onto the Oren–Nayar model.

What value does this provide for War Thunder?

Physically Based Rendering technology takes into account the features of each material. Using mathematical formulas which include the properties of terrain and its surfaces, it calculates and displays the correct behavior of light that hits the object. This has allowed planes and tanks to look more natural and varied, particularly at different times of day and in different weathers. The shabby metal fuselages of planes reflect light and glimmer as they maneuver. At high graphics, every piece of detachable equipment on a tank, even the smallest piece, isn’t uniformly hidden in shadow. Instead, it reflects light from nearby objects.

 

 

 

 

 

 

 

 

 

Read more:
HQ17: Rockets in the Night Sky
  • 17 December 2024
Eurofighter Typhoon: Oncoming Storm!
  • 13 December 2024
Introducing the Tiger and Ostwind Pack!
  • 13 December 2024
Panzerhaubitze 2000: Best In Its Class!
  • 12 December 2024