- 14 minuti fa
Video diario sul ray-tracing per World of Tanks.
Categoria
🎮️
VideogiochiTrascrizione
00:00Very soon, raytracing technology will appear in World of Tanks.
00:05It will help render realistic vehicle shadows.
00:09It looks beautiful, but how does this technology work?
00:12And will players need a special graphics card with raytracing support for these new shadows?
00:17Let's find out.
00:30After Update 1.0 was released in March 2018 with full revamp of the graphics, work on the new Core
00:38Engine continued.
00:39Since then, our developers have implemented concurrent rendering, and we've ceased to support Windows XP and DirectX 9.
00:48As a result, our developers can move forward and integrate new technologies into the Core Engine.
00:54One of these technologies is raytracing, which can bring shadows to the next level.
00:59The correct implementation of shadows has been one of the industry's biggest problems for a long time.
01:05In our case, this means implementing correct vehicle shadows.
01:09However, it can't always be reached with the help of rasterized graphics, the modern approach used nowadays.
01:16And this means finding a constant balance between quality and performance.
01:21Currently, the dynamic vehicle shadows are made using shadow mapping.
01:26Basically, it's a regular texture, and its resolution is limited, which causes some problems.
01:32The shadows are not detailed enough. You see jagged edges when zooming in.
01:36Shadows can lag behind the object, and they are not rendered at all at a distance of more than 100
01:41meters.
01:43In theory, we could increase the shadow resolution, but it would lead to a higher load on the graphics card
01:48and a drop in frames.
01:50At some point, our vehicles became more detailed than their shadows, and we wanted to improve our shadows in some
01:57way.
01:57One of the approaches we considered was implementing ray-traced shadows.
02:04Implementing ray tracing gives us a fundamental solution for this problem.
02:10The shadows will be sharp or soft in those very places where they should be.
02:17Basically, they will try to simulate real-life shadow behavior.
02:22Ray tracing works like this. Each point on a screen corresponds with a point in the 3D scene.
02:28In order to know if the shadow from the vehicle is there, the graphics card sends a ray towards the
02:33light source
02:34and checks whether this ray meets the vehicle or not.
02:37Sounds simple enough, but the graphics card doesn't always see the tank the way we do.
02:41To it, vehicles are a set of polygons, or triangles, and to find out whether the ray intersects one of
02:47them or not,
02:48the graphics card needs to go through all these triangles one by one.
02:52The problem is that a vehicle in our game consists of 50,000 polygons on average,
02:57so such calculations would take too much time, especially when there are several tanks nearby.
03:04To speed up ray tracing, a special BVH structure, bounding volume hierarchies, is used.
03:11It's the hierarchical structure of the geometrical objects.
03:14What's the idea behind it?
03:17Well, it distributes the triangles to specific boxes and saves on the number of intersections.
03:28It looks like this. The processor sorts the triangles into boxes with four to eight triangles in each.
03:34Then it takes two boxes and puts them in a larger box.
03:37This process is repeated until the tank is presented as big boxes.
03:42For example, one box could be the hull, tracks, turret, or gun.
03:47On average, the nesting depth is about several dozen boxes for a tank.
03:51Now the graphics card is working with only a few dozen boxes and not 50,000 triangles.
03:57In case the ray doesn't intersect with any box, there won't be a shadow from the vehicle in the selected
04:02surface point.
04:03If it does, the graphics card checks which of the two boxes the ray intersects with, and it does so
04:09until the ray intersects with the smallest box.
04:12After that, the graphics card goes through all triangles from that box and finds out the exact triangle the ray
04:19intersects with.
04:20Then the correct shadow will be rendered in the selected spot.
04:23Thanks to this box structure, the number of intersection checks is reduced from 50,000 to several dozen for one
04:30tank.
04:32The ray tracing is done by the graphics card, and the BVH structure preparation is calculated by the CPU.
04:40At 60 frames per second, the frame time takes 16.6 milliseconds.
04:45This is the general time for the whole frame, so we should update all game logics and complete all rendering
04:51during this time.
04:53Our first implementation of building the BVH structure using the CPU took about 8 milliseconds.
04:59It was a half of the whole timeframe budget. We couldn't release it with that level of performance.
05:04But our partners from Intel offered us their solution.
05:07It turned out that they had had a library called Intel Embry for a long time.
05:12It specializes in quick BVH building, and has been mostly used in offline applications, the movie industry, computer animated films,
05:20and so on.
05:21During our ongoing collaborations, we found out that Wargaming Engineering team
05:28planned to increase shadow quality using ray tracing.
05:33But they are facing some challenges with the performance, particularly with calculating required acceleration structures.
05:42So, we immediately proposed to use one of our instruments, which include very high-efficient instrument for that.
05:52And during our collaboration, after consulting with our advanced rendering team,
05:58the Wargaming Engineering team was able to implement this instrument into the game in less than a week.
06:07As we implemented the multi-core technology and solutions for concurrent rendering in Update 1.4,
06:18the Intel Embry technology suited us very well.
06:23We could make it concurrent as well.
06:29And BBH building now takes little time.
06:34It takes so little time that we could basically forget about it.
06:39Ray tracing worked as intended.
06:42Now building the BBH structure of 30 vehicles takes 1.5 milliseconds on average.
06:47Then this structure is sent to the graphics card, which helps it to trace rays 1,000 times faster.
06:53The next problem to be solved was creating soft shadows.
06:57In video games, a light source, for example the sun, is often represented by a point to optimize the load
07:03on the graphics card.
07:05As a result, only two scenarios are possible.
07:07The point on the ground is either covered by an obstacle and can't see the light source.
07:12In this case, there's a shadow, or vice versa.
07:14A point sees the light source and there will be no shadow.
07:18In reality, the light source, for example the sun, emits light from many points on its surface.
07:23For a point on the ground, the sun can be partially covered by an obstacle.
07:27This means it illuminates a point on the ground, not with all its surface, but just a part of it.
07:33That's how penumbra appears.
07:34In other words, a half-shade or a soft shadow.
07:37The movie industry gets such realistic effects with computer-generated imagery by sending thousands of rays per pixel.
07:44But processing a single frame can take several days.
07:47In games, you need to process the frames 60 times per second.
07:52To maintain performance after implementing ray tracing,
07:58we had to use one ray per pixel.
08:03It's obviously not enough.
08:08And it's very noticeable in the penumbra areas, where the half-shade is.
08:14Since we are limited to one ray and can't send hundreds and thousands of rays per pixel to the many
08:19light source points,
08:21we randomize this ray in every frame.
08:25It gets to different light source points, the sun in this case,
08:30and we get noise from this randomization.
08:33To remove this noise, we use a denoising algorithm,
08:38which uses a temporal and spatial coherency of points on the ground, or pixels,
08:45so we can approximate what penumbra should be.
08:50The point of denoising is to filter the picture,
08:55basically to apply blur to particular pixels.
08:59The algorithm is quite complex,
09:03because it's very smart in defining where we need to apply this blur and where we don't.
09:09We want the half-shades to become soft and noiseless.
09:13But at the same time, we want the shadows close to the objects, the contact shadows, to remain sharp.
09:19Using one ray per pixel and denoising let us significantly increase the number of FPS,
09:25and render the picture with one ray, with the same quality as if we would trace eight or sixteen rays
09:32per pixel.
09:33At the same time, ray tracing in World of Tanks is implemented in a way that it can be run
09:38on any graphics cards that support DirectX 11.
09:42You don't need a special graphics card with hardware ray tracing support to see the new realistic shadows in World
09:48of Tanks.
09:48World of Tanks engineering team did a tremendous job scaling their engine and rendering pipeline across the widest variety of
10:01hardware which gamers have.
10:03So, each gamer has a very big flexibility finding the balance between performance and quality,
10:13and even can enable technology like ray tracing on a latest notebook computer with latest generations of Intel integrated graphics.
10:25Despite the fact we can run it on a wide range of hardware,
10:29it doesn't change the fact that the ray tracing technology is quite demanding.
10:36The users who want to try it will be able to enable it manually.
10:41It won't be enabled by default, for example, on Ultra settings.
10:46It will be an option that needs to be activated by players themselves.
10:51If you have some extra FPS, your game shows 200 or 300 FPS on the Ultra preset,
10:57and you want to use all your graphics card power,
11:00you can easily turn on ray tracing and enjoy the graphics.
11:04To check how this technology works on your hardware, you can already test it in World of Tanks Encore RT.
11:14We decided to use World of Tanks Encore as we did before the Update 1.0 release.
11:22World of Tanks Encore will now let our players try ray tracing in-game.
11:30You can already download the World of Tanks Encore RT app, launch it, adjust the ray tracing quality,
11:39check if your computer can handle it, and see the visual difference.
11:44Concurrent rendering support was also added to the new iteration of World of Tanks Encore.
11:49You can see in a special window how many cores are used when rendering a frame.
11:54World of Tanks Encore solves two tasks for a player.
11:59It allows players to try out the future capabilities of the graphics engine,
12:06and measure the performance with these technologies provided by World of Tanks Encore.
12:12You can see that you're ready for the future World of Tanks graphics update.
12:18That your hardware, your PC, you carefully dust every day, is ready for it.
12:24You can also download the previous version of World of Tanks Encore
12:28to compare how the performance and graphics in World of Tanks has changed.
12:32Now, with the help of ray tracing, in-game shadows don't suffer from the biggest problems that stem from shadow
12:39mapping.
12:40We have sharp shadows from small details, and soft shadows in the penumbra area.
12:48Visually, we got close to displaying real-life shadows.
12:57The ray tracing technology has broad applicability.
13:05From the use of ray tracing for everything possible, to hybrid versions.
13:12In our case, we use a hybrid approach.
13:16When a part of the picture you see on your screen is processed by the old raster method,
13:23and another part is generated with the help of the new advanced ray tracing method.
13:29Shadows are only the start of ray tracing.
13:33Much more can be done with the help of this new technology.
13:36Realistic reflections, ambient occlusion, global illumination, and the whole frame in general can be generated using it.
13:44But billions of rays for one frame need to be processed to do so.
13:49No computer can do it in real-time currently, and it'll be a long time until it's possible.
13:54But you'll be able to enjoy ray-traced shadow in World of Tanks in the near future.
13:59The End
14:06Grazie per la visione!
Commenti