Today, we’re taking a look at motion blur in War Thunder — what it is, how it’s implemented in the game, and what challenges we were facing. War Thunder goes to the movies!
What Is Motion Blur?
In a video game, images are created from scratch, each frame displays a single point in time.
Real cameras or even our eyes don’t work like this. Taking a picture takes time, and over this time the world doesn’t always stand still. If an object moves while we’re taking the picture, it will appear in all those places at the same time on the final image. This is what we call motion blur.
Explanation Of The Basics
To simulate the effect of motion blur, we need to know how every pixel has moved since the last frame. This requires all animations and moving effects to report their current and old positions. It can be one of the hardest parts of making this feature work. But thankfully we already had this working for anti-aliasing techniques. The few animations that didn’t support this became very easy to spot because motion blur turned them into a big blurry smudge. So we fixed them quickly!
For a starting point, we used a proven technique for implementing the effect, you can read more about that here. Basically we check where a pixel was in the last frame and where it is now, then we blur this pixel along the line in between.
To make calculations more efficient and smooth out some edges, the line is also blurred in the forward direction extending the line past the current pixel position. To speed things up further we make some decisions together for bigger blocks of pixels based on their general direction.
Each pixel’s distance from the camera also needs to be considered to let us blur the background and the foreground separately. The blurred line of a background pixel can sometimes pass behind a still standing, sharp object in the foreground. Other times we need to keep the background sharp while a foreground pixel is blurred on top. When two objects blur together in a single pixel, their individual speed is also important because sometimes neither must stay sharp.
Technical Challenges In War Thunder
Of course we needed to make some tweaks to shape it to our needs. To decide how to blur a pixel we need to know its speed. But what if there’s no single answer because there is more than one thing visible in the same point? Without special care, transparency is invisible to the algorithm.
In War Thunder, we have glass cockpits and colored light bulbs attached to planes flying over trees while breaking the sound barrier. So we needed to treat glass surfaces somehow. Here, we have completely different speeds all on the same pixel. The glass is steady but the forest behind it is very fast.
We ended up using a similar trick as with the background-foreground separation. If we see something through glass, we treat that as one category, while directly visible objects are another. We don’t blur one category on top of another but we allow mixing within categories.
This way we achieve images where the background is blurred through the glass but the glass itself can maintain its sharp silhouette.
Note: at the time of writing this post, special treatment of transparency is only enabled if Motion Blur is maxed out.
Limitations
Since we only have a single known speed for each pixel, fast moving transparent objects won’t be blurred, only the background objects you can see through them. This also means that reflections on such surfaces can only be blurred based on the background.
To create a perfect effect we would need perfect information. Even if we know a pixel’s screen position in both the past and the current frame, we don’t know what path it took between the two. We just blur it in a line, as if it was moving straight, which is almost always good enough. One important exception is the wheels of vehicles. Here, one point on the wheel can move to the opposite side in a single frame’s time. Assuming straight movement here is far from reality.
For the time being this issue is not solved, wheels will need a custom method for correct motion blur that works on different principles.
Is It Realistic?
Motion blur is visible not only for fast moving objects, but also if the camera itself moves. On film this is a very common effect, but in our natural vision the eye usually locks onto objects keeping the world more steady for us. Video game motion blur is cinematic — it looks like a real movie made with real cameras. But it’s not like seeing the world with your own eyes.
To better simulate human vision, we added an option to disable motion blur caused by the movement of the camera. This will still blur fast moving objects like planes flying by, or exploding debris, but will keep the image sharp when you’re just looking around.
Is Motion Blur Good For Our Games?
We hear this question a lot and internally had conversations about this as well. Some say it gives the feeling of motion and makes the experience more immersive. While others say it makes it harder to aim for moving targets, it removes clarity that’s important for competitive play. Well, they are both right. It’s a matter of taste and what you want from the game. If you’re most interested in winning and climbing the ladder, it may not be for you — feel free to turn it off. We’re completely fine with that. But if you’ve already won and you’re making a highlight reel from your replays, or just want to feel the speed as you’re flying, you can max it out and use it for a movie quality effect.