Graphics, story, gameplay, and technology. Every player pays close attention to these features and expects them to be present in the game. They are the fundamental properties of a video game. The extent to which they are creatively programmed and how interesting the end product is largely depends on the game engine and the development team. But even the best game development studios, with a long history of games that have an interesting and exciting story, good action, and stunning graphics, cannot create a video game that fully conveys the realistic illusion of the world.
One might wonder what it is that subconsciously lets us know it's still a game. So many factors make millions of people enjoy gaming, and so many gamers are absolutely dedicated to their favourite title, spending countless hours searching for a rare collectible or just wandering through the world. Yet, there is still one thing that can be improved, a naturally existing property that makes us love the real world. One reason why some people love the new GTA trailer are functioning rearview mirrors. Such a small detail, yet it makes a crucial difference in how we perceive a game as realistic.
Light and Reflection
Some animals have the ability to see in the dark, but unfortunately, we humans do not. When it is dark inside, we turn on a lamp or a ceiling light; outside, we use a flashlight to illuminate our paths. We need light to produce vital vitamins, and without it our planet would be uninhabitable. Light is so fundamental to our lives that it would seem easy to implement it in computer game code, yet it remains one of the greatest challenges developers face.
In classical electrodynamics, light is considered a high-frequency electromagnetic wave. To be specific, what we commonly refer to as light, i.e. visible light, is only a section of the electromagnetic spectrum, one that is visible to the human eye, with wavelengths between 380 and 780 nm. It consists of many light waves, and each wave has its own properties that change its colour. When light passes through a transparent medium, the wavelengths are slightly compressed, and the speed of light decreases.
Implementing light, shadows and mirrors still poses a significant challenge for video game developers. Light and shadows consume an enormous amount of processing power and depend heavily on the performance of the graphics card and the device's processor, which is partly why most games look better on PC than they do on game consoles.
To encode light and shadows, programmers must use features that require quite some skills to correctly and smoothly render a simple shadow. The errors that they do are often visible in mirrors: usually they are fixed in a static state of the camera (character) or either dirty or broken (as if that would prevent the mirror from reflecting its surroundings!). There are several reasons why mirrors in video games often do not work correctly. Since traditional light waves do not exist in digital space, developers must use alternative techniques to simulate reflections. The effectiveness of the approaches can vary significantly.
One of the methods used is called planar reflections. In planar reflections, programmers integrate an additional rendering pass for the entire environment. This essentially involves creating a room and introducing a virtual camera that acts as a reflecting mirror. This methodology is particularly effective for straightforward, minimalist rooms that do not have many complex details as highly complex scenes are less compatible with planar reflections.
Another technique, though a bit old-fashioned but still effectively used, is Cube Maps. Cube Maps is a texture mapping method used in 3D computer graphics and video games to recreate the environment of an object or a scene. They consist of six 2D images, each representing a view from a specific direction corresponding to the six sides of a cube. Cube Maps are frequently used to simulate reflective surfaces such as water, glass, or metallic objects. By sampling the Cube Map, the renderer can determine what should be reflected on the surface of the object.
An approach that offers a good balance between visual quality and performance is Screen Space Reflections (SSR). This method is used to simulate the reflection of objects in mirrors, water, or other reflective surfaces by analysing the content of the screen and calculating reflections based on what the camera currently sees. Since SSR operates in screen space, it only considers what is currently visible on the screen. It does not generate reflections for objects that are outside the screen, which can be a limitation compared to other reflection techniques.
By far, the best available technique is Ray Tracing. As a graphics technology, Ray Tracing enables smooth simulation of light effects. An algorithm sends rays into a 3D graphic, tracks the paths of the rays, and calculates a realistic lighting model. Ray Tracing simulates how light behaves when it hits reflective and refractive surfaces. When a ray hits a reflective surface, it generates a reflection ray, continuing the simulation of light bouncing off the surface. Similarly, when a ray hits a refractive surface, it generates a refraction ray to simulate the change in the direction of the ray as it passes through the surface.
With the help of Ray Tracing and other light simulation techniques, game developers can now create lighting in games that looks more realistic than ever before. We have struggled with a good representation of world reflection in games for more than 20 years, and properly functioning mirrors represent one of the greatest achievements in the world of game development. Of course, the path to an illusion of light that would be indistinguishable from reality is still quite long and bumpy. However, thanks to the continuously evolving programming and the development of even better game engines or software, the future of lighting in video games seems to be very bright :)
Comments