4

I'm watching a video that goes through the details a JetBlue Airbus A320-200 incident from 2005. In the video they're using some kind of flight simulator software to illustrate various things like the plane flying, or instruments in the cockput. About 10 minutes and 10 seconds in, they show a closeup of the flaps lever. I noticed that the area where the shadows fall off is very jittery and kinda blocky looking, and I realized that I've seen this before in a lot of games.

My assumption is that getting perfect shadows is likely a waste of developer time and computer resources when you're going to be more focused on playing the game, than noticing if the shadows casting on stuff looks perfect, but I'm curious:

What causes the shadows to jitter around like that, and wouldn't there be some kind of smoothing operation you could apply, similar to how you'd smooth out player movement in a 2D game or something?

2
  • I'm not sure on the specifics of the heuristics used, but "getting perfect shadows is likely a waste of [..] computer resources" is correct. Oct 16, 2022 at 4:21
  • @BlueRaja-DannyPflughoeft But getting "perfect" foliage, or materials, or physics, can equally be a waste. It really depends on the game (apart from the fact that we're a long way from 'perfect' simulation).
    – Joachim
    Oct 24, 2022 at 11:39

1 Answer 1

3

My assumption is that getting perfect shadows is likely a waste of developer time and computer resources

That is correct, but only for games that don't use ray tracing.

With ray tracing, perfect shadows are trivially easy to achieve. Ray tracing is all about the accurate simulation of light, and shadow is simply the absence of it. However, ray tracing itself is very computationally expensive, to the point where computers have only recently become powerful enough to use it in real time. As a result, we are currently in a transitional phase, where some games support ray tracing partially, some don't, and almost no games support it exclusively.


So how exactly are shadows achieved without ray tracing?

Unlike ray tracing, where all shadows are the same, traditional computer graphics differentiates between two different types of shadows which are computed differently. The ones you are looking at are known as "projected shadows" and are computed using a technique known as shadow mapping.

You can think of the shadow map as a kind of texture that is rendered on top of a surface. Like any other texture, it has a fixed resolution. Unlike any other texture, it is generated dynamically, most likely cannot be stored since there is no guarantee that it won't change in the next frame, and is therefore very computationally expensive.

Textures also require a significant amount of memory, which is why they are stored in VRAM in compressed form. Since the shadow map must be calculated on the fly, it cannot be compressed, unlike regular textures.

The reason the shadow is blocky and jittery, is because its resolution is too low, so a single point of the shadow map needs to be displayed by multiple pixels on the screen. This usually only happens if the graphics quality is set too low, or the camera got too close to the shadow. This can be solved by increasing the shadow map's resolution, but can result in lots of resources being wasted, as multiple points of the shadow map would be displayed on a single pixel on the screen.

wouldn't there be some kind of smoothing operation

The shadow map is already being smoothed in the video, otherwise it would be a lot more blocky. From the looks of it, the shadow map's resolution appears to be very low, so the smoothing can't fully hide it. It's quite possible the dev team never expected the camera to get this close to the controls, or they deemed that such a situation would be too niche to justify increasing the shadow map's resolution at the expense of performance.

3
  • What do you mean "exclusively"? Metro Exodus forces you to use it? I thought it was a setting you can choose to have on in games (after all, its quite performance taxing)
    – Timmy Jim
    Oct 17, 2022 at 0:42
  • 2
    @TimmyJim, there are 2 versions of Metro Exodus. The original (2019), where ray tracing is used in addition to traditional lighting and can be turned off, and the PC Enhanced Edition (2021, free for owners of the original), which only features ray tracing. I removed the mention of Metro Exodus from my answer, as it is ultimately irrelevant.
    – Nolonar
    Oct 17, 2022 at 0:52
  • Makes perfect sense. Thanks for the detailed explanation!
    – Grayda
    Oct 17, 2022 at 2:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .