Why do shadows in some video games jitter?



  • I'm watching a video that goes through the details a JetBlue Airbus A320-200 incident from 2005. https://youtu.be/Rpsgn9LM0G8?t=606 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?



  • 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 https://en.wikipedia.org/wiki/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.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2