In this week’s blog, we would like to talk about the newly introduced engine version 1.4 which consists of many graphical improvements as well as a number of performance updates.
We develop engine features in separate branches with each one labelled as a version. This allows us to test new features extensively and efficiently without decreasing the stability for the gameplay programmers.
We introduced a new global illumination system to the engine which can correctly illuminate both static and dynamic objects. It is based on a pre-baked system called "Precomputed Radiance Transfer". It is independent from the atmosphere, which is a must for a game like Bannerlord where you will enter a scene at different times of the day. The system saves the illumination data to probes inside a regular grid. We developed lots of automatic placement tools so that the work required by artists to bake the scenes is kept to a minimal. Modders will be able to bake GI to their scenes using these tools.
Compute Shader Skinning
By using profilers we have learnt that in large-scale battles the majority of the GPU time is spent on the skinning of agent meshes. Normally, the skinning process is repeated every time a mesh needs to be rendered (shadow pass, gBuffer pass, special passes for custom hair shading etc.). To combat this, skinning calculations of skeletal meshes have been moved from the vertex shader stage to a separate compute shader stage. Despite both stages running on the GPU, executing a separate stage for skinning and storing results in temporary memory enables us to do skinning calculations only once per frame and use special optimisation mechanisms that are exclusive to compute shaders. This results in the rendering time of skinning meshes being reduced by 60% which enables us to achieve 60FPS in huge battle scenes on a wide range of GPUs.
Particle Shading Atlas
Particles are now shaded in a separate compute shader stage. Each visible particle is assigned a rectangular region (2x2, 4x4, 8x8, 16x16 or 32x32) in a big global texture atlas according to its screen space size. Shading is done on these tiny quads with a compute shader stage. During the actual rendering, we just sample the lighting result from the atlas texture and skip any complex lighting computation. Separating shading and drawing stages enables us to reduce the fill rate costs of particles since the amount of shaded pixels are extremely reduced. This reduces the high GPU cost of the desert-like scenes. This technique also eliminates the sharp shadows on the particle quads, further increasing the visual quality of the already beautiful particles of Bannerlord!
At this point we feel it is important to stress the fact that while yes, we are still developing the engine and making new additions: this work is running entirely parallel to the development of Bannerlord. Our dedicated engine team are constantly striving to give us a better optimised engine which allows us to have larger battles, higher frame rates, greater visual fidelity and faster loading times. This work doesn’t hold back the development of the game in any way, shape or form and will ultimately improve the overall quality of the final product.
In next week’s blog we will be talking to Gameplay Programmer, Korneel Guns. Korneel’s main focus is on the multiplayer aspect of Mount & Blade II: Bannerlord. If you have any questions you would like to ask him please leave a reply in the comments and we will pick one out for him to answer!