Popularly about 3D graphics. Part 2. Games and 3D


    I apologize for such a long break between the first and second parts, but there were both objective and subjective reasons. So, part two, about computer games and 3D.
    And, yes, the article is intended for those who have no idea about this issue at all.

    3D graphics in computer games
    When I bought my first computer, the ZX Spectrum, and learned how to download games from the cassette with the money I earned in summer in high school, I immediately began to wonder: how is everything programmed? I got the answer to this from the game programming book for the ZX Spectrum. When I got a PC-compatible computer, I already imagined how the games are made. But quite a bit of time passed and games appeared that were unlike the others - games with 3D characters. One of the prominent representatives of such games was Tomb Raider. And every year the number of such games grew. I was always wondering: how are they created? But I did not find an intelligible answer (the Internet was then exotic). If at the time I came across a similar article, then I would get answers to some questions. I hope


    But first, a little about landfills. In the last article Popular about 3D graphics, part 1polygons were mentioned. But judging by the comments, the purpose of the article was not quite achieved. Therefore, I want to dwell a little on tessellation and smoothing. Imagine you have a piece of paper. This will be the landfill. Divide it in half horizontally and vertically. We get 4 parts. This is tessellation. Why do we need this in 3D graphics? The thing is that the polygon is the basic unit of the surface (in polygonal modeling) and only a plane can be simulated by it. Remember that in order to make a paper airplane you need to bend a sheet of paper several times. So it is with polygons - breaking the initial polygons into parts, placing them at the right angles to each other and smoothing, you can get these or those shapes. Smoothing, as mentioned in the last part, is a partition of polygons with a change in the angles between the polygons. This means that if we have a square, which, as you know, has right angles of 90 degrees, then after smoothing, these angles will be about 135 degrees. How the smoothing operation transforms the model blank can be seen in the video below.

    In this case, two smoothing iterations are applied. You can see how the number of polygons increases and the model takes on smooth shapes.

    But back to the games.

    At the dawn of personal computers, graphic (there were also text, yes, yes, text! Games) games were two-dimensional in every sense: the characters were drawn in projection and could only move along the X and Y axes. To simulate walking, for example, the position of the legs was drawn at different periods of time, and these frames simply started in circles. A classic example of a two-dimensional game is Tetris. The video below shows footage from the two-dimensional Nebulus game for the ZX Spectrum platform, which was unusually popular in the 80s (and in the CIS and in the 90s) of the last century.

    But computers have grown and in recent years, most games are three-dimensional. What gives us three-dimensionality? (by the way, the final picture for ordinary monitors is still pseudo-three-dimensional, but due to the placement of objects in perspective and the ability to move in three dimensions, the illusion of three-dimensionality appears). Three-dimensionality gives us more freedom and realism. Take a look at these chess, one of which is two-dimensional, and the second is three-dimensional. Which of them look more realistic?

    How does a three-dimensional character appear in the game? To begin with, the modeler makes a high-poly model of the necessary object or character in one of the three-dimensional modeling programs (for example, 3ds Max or Maya, revision in ZBrush or Mudbox is possible). Then, a scan is built - a representation of the drawing of a three-dimensional object on a plane. Based on the scan, the artist draws textures, i.e., roughly speaking, paints the model, then the materials, including the drawn textures, are adjusted. Materials allow you to give textures realism. The model is ready. But a low-poly model is needed for the game. It is obtained from high poly or copied at a certain stage of high poly simulation. Why do we need a high poly model? It makes it possible to get a more realistic picture, simulate small details, shadows, which will then be present in the game as a texture. A lot of what we perceive in games as small objects (grooves, corrosion, cracks, latches and much, much more) is actually drawn taking into account shadows, which, when not examined in detail, is perceived as a three-dimensional object. An auxiliary texture is obtained from the high-poly model. As a rule, in addition to the texture of the color and the pattern, the texture of the relief (bump) and reflection (specular), a normal map are used. Superimposed on the texture of the picture (diffuse) they make the model more realistic. All this allows you to reduce hardware requirements to the level available for modern iron. latches and much, much more) is actually drawn taking into account the shadows, which, with not very detailed examination, is perceived as a three-dimensional object. An auxiliary texture is obtained from the high-poly model. As a rule, in addition to the texture of the color and the pattern, the texture of the relief (bump) and reflection (specular), a normal map are used. Superimposed on the texture of the picture (diffuse) they make the model more realistic. All this allows you to reduce hardware requirements to the level available for modern iron. latches and much, much more) is actually drawn taking into account the shadows, which, with not very detailed examination, is perceived as a three-dimensional object. An auxiliary texture is obtained from the high-poly model. As a rule, in addition to the texture of the color and the pattern, the texture of the relief (bump) and reflection (specular), a normal map are used. Superimposed on the texture of the picture (diffuse) they make the model more realistic. All this allows you to reduce hardware requirements to the level available for modern iron. Superimposed on the texture of the picture (diffuse) they make the model more realistic. All this allows you to reduce hardware requirements to the level available for modern iron. Superimposed on the texture of the picture (diffuse) they make the model more realistic. All this allows you to reduce hardware requirements to the level available for modern iron.
    Then the low-poly model and textures are exported to the so-called game engine which allows, as a rule, to simulate a certain world. The game engine is responsible for the gameplay itself: the interaction of the hero with the world, visualization of the image in real time, for the artificial intelligence of computer characters. 3D game engines are different: both paid and free, free for non-commercial use, complex and difficult to learn, for various platforms, etc. If you decide to experiment with exporting your own models to the game engine, the main thing is to be able to convert the model in the format of your 3D editor to the format of the game engine, and the latter works on your platform.
    In order not to be unfounded, in the video below I will briefly show how the model is inserted into the game engine. For an example I took CryEngine 3. Why exactly it? Because the well-known shooter Crysis 3 "runs" on it, moreover, the engine itself is available for free download and free for non-commercial use. For CryEngine 3, documentation is available in both English and Russian, there is an extension for 3ds Max.



    That's all for now.

    Previous articles in this series:
    Popularly about computer graphics. Part 1 Introduction and polygons.

    Also popular now: