Fast and Furious: Forza Horizon 4 acceleration due to window shaders

Original author: Gareth Harwood
  • Transfer
image

Gareth Harwood - Technical Art Director Playground Games

Action Forza Horizon 4 takes place in the beautiful British filled instantly recognizable sites and attractions, including a model of the city of Edinburgh in version Playground Games.

In most open world games, particular attention needs to be paid to the speed of streaming data, and Forza Horizon 4 with its detailed and variegated city is no exception. Edinburgh buildings needed new resources for building resources, rendering, and engine functionality to load models when driving at 300 miles per hour.

A modular solution that reduces memory load


Buildings were created by reference from the real world. To do this, it was necessary to take a picture and make a lot of houses, but we can create and physically store a limited number of buildings on the disk. To cope with this limitation, while retaining the variability, we created an interchangeable modular set of objects that are added to buildings ; These include objects such as window frames, entrances, antennas and security alarms. We also provided the ability to change the colors and shades of parts of these objects. Such a system was ideal for creating a series of houses with terraces, each of which has a door of its own color.


In Edinburgh, we needed to create a huge number of buildings in a relatively small area. Loading these buildings for a small part of our open world significantly increased the amount of memory required. To cope with this, we built buildings from modules taken from the libraries of the first floors, upper floors and roofs, which could be connected in various ways, obtaining variability and an interesting picture with low memory requirements.

In addition, it allowed us to shift the complexity of the models closer to the first floors; the windows next to which the player passes are more detailed than the roofs, which are visible only from a distance. Unique buildings like the Scott Monument and the National Gallery combined with modular buildingsreduce the monotony of the picture, while at the same time maximizing reuse of resources and variability .

Implement parallax textures



Realistic worlds have always been a strong feature of Forza Horizon games , and one of the ways to create them was to add interiors to buildings.

We knew that in Forza Horizon 4, Edinburgh would be so densely built and detailed that physically modeled interiors would create an overload. Therefore, we decided to use another technique called “parallax textures”. They gave us a huge advantage when creating interiors. When baking them in texture, they are not limited by the number of polygons and the complexity of materials. Rendering such textures is less expensive than creating geometry, so the game can have more interiors. Previously, it was necessary to close the windows with curtains or shade them, but now we have completely parallax interiors.


The materials of parallax interiors consist of three layers, each of which is individually chosen by artists for each of the windows. Since each layer has several different variations, they create hundreds of possible external views for each window, even if a small amount of texture atlases is used.

The first layer is simple, it contains only the window frame and glass. He adds such nuances as stained glass and lead glass, typical of old British architecture. This layer has diffuse, alpha, roughness, metalness and normal pass. The normal pass contains a variation of each stained glass to add a realistic variation of the angles of reflection of glass, which is especially noticeable in old stained glass windows.


The second layer is used for curtains or curtains. They have diffuse and alpha, as well as a light-transmitting texture that is used at night to show the thickness of the curtains. We have thick curtains that do not let in light, translucent curtains, and even curtains with ornaments that we created from holes that partially let in light.


In the last layer, all the shader magic is created - it consists of a flat texture imitating a three-dimensional interior. The interiors are first modeled in 3D at the same scale, and then rendered in a unique texture format supported by our shaders of parallax interiors. As in all other layers, we in this layer create atlases containing up to eight different interiors of the same style in order to reduce the number of draw calls.

We have several village atlases that are rendered on village houses, atlases for city houses, as well as several atlases of commercial establishments that are superimposed on shops, restaurants, and classic British pubs. We also have two main depths of interiors. One is for standard rooms, the other is for shallow windows. Artists can choose which part of the atlas they want to use for each window of a building, and then set materials using the properties of the polygonal model of each window.


The shader calculates the angle at which the player looks into the room, and modifies the UV coordinates so that he sees only the part of the interior that would be visible at this angle. This technique has several limitations that we have coped with.

First, the shader trick becomes noticeable at very sharp corners. In such boundary cases, we increased the natural Fresnel glass effect to show more reflected image than the interior. Secondly, as the corners increase, the details in the center of the room begin to distort. We reduced this effect by shifting accents to walls and corners, darkening the floor. As in real life, the parallax effect allows you to reduce lines that fall into one focal point. In our images, we took advantage of this by maximizing the use of parallel lines: in tiles, bookshelves, wooden flooring and wallpaper patterns.

Each interior texture also has a lighting texture for evening light. Due to the benefits of baking the texture, we could use any number of light sources, because as a result they all turn out to be written into the texture. Each building has variations with lights on and off.


Artists were free to choose any combination of windows, curtains and interior, but they followed simple rules: bedrooms are usually located on the upper floors, you cannot use the same rooms in each window, and there are no stairs leading up on the upper floors. We also considered how convincing each room is. For example, we could not have a small two-bedroom cottage in which ten or more windows lead to different rooms, so the artists created the windows so that they looked like different parts of the same room.

Finally, to improve performance when the player was removed from the building, we needed to reduce not only the complexity of the mesh, but also the complexity of the shaders and materials. To do this, we turned off the parallax effect and replaced the window with a flat image containing a window, curtains, and an interior in one layer. Replacement occurs when the window takes up little space on the screen and is unnoticeable to the player.


Regardless of whether you are traveling leisurely around Edinburgh in your vintage roadster, viewing each storefront, or traveling at a speed of 300 miles per hour on a supercar for a million pounds, Forza Horizon 4 will recreate a beautiful, realistic and interesting environment. Each technology, rendering method, shader and texture work in harmony, creating one of the most technically complex parts of the Forza Horizon 4 card .



From the translator: for greater clarity, I found a video that shows the interiors of the game.


Also popular now: