
We all heard about 3D graphics (hereinafter referred to simply 3D, not to be confused with the display method — holograms, 3D monitors, etc.), many are well aware of what 3D is and what it is eaten with. But, nevertheless, there are those who vaguely imagine what lies under this short abbreviation. The article is designed for those who have no idea about computer graphics. There will also be a bit of insight into the history of computer graphics (in the following planned parts).
Why 3D? As you might guess, we are talking about 3 Dimension, or three dimensions. And not necessarily at the same time that the display was in 3D. It's about how to build a picture.
Part 1. Actually, modelingTraditionally they draw in 2D (along the X and Y axes) - on paper, canvas, wood, etc. At the same time display any one of the sides of the subject. The picture itself is flat. But if we want to get an idea about all sides of the subject, then it is necessary to draw several drawings. So come in a traditional hand-drawn animation. But at the same time, it exists, (by the way, in the USSR it was quite well developed) so-called. puppet animation. Once made, the doll is removed in the necessary poses and angles, receiving a series of "flat pictures". 3D (the Z coordinate of depth is added to X and Y) visualization is the same “dolls” that only exist in digital form. In other words, special programs (Blender, 3ds Max, Maya, Cinema 4D, etc.) create a three-dimensional image, for example, an auto.

The advantage of this method is that, for example, an animator has a three-dimensional model, you just need to put it properly in the frame, animate (set the trajectory of the movement or calculate using the simulator) if necessary, and the display of the car in the final picture falls on a special a program called a renderer. Another advantage is that the model is enough to draw once, and then use it in other projects (by copying), modify, deform, etc. on your own. For a normal 2D drawing, in general, this is impossible. The third advantage is that it is possible to create almost infinitely detailed models, for example, to model even cogs on watches, etc. In general terms, this screw can be indistinguishable, but if we bring the camera closer, the visualizer will calculate for itself what is visible in the frame and what is not.
There are several ways to model, but polygonal modeling is the most popular. Often you can see in a movie about 3D or science fiction films as one or another object is presented in the form of a so-called. mesh. (see picture above) This is an example of polygonal modeling. Its essence is that the surfaces are represented as simple geometric two-dimensional primitives. In computer games, these are triangles, for other purposes they usually use quadrangles and figures with a large number of angles. These primitives that make up the model are called
polygons . But when creating a 3D object try to do, as a rule, quadrangles. If necessary, quadrangles (polygons) without problems turn into triangles when exporting to the game engine, and if necessary, smoothing or tessellation the model from quadrilaterals is obtained, as a rule, without artifacts.
What is tessellation? If some object is represented as polygons (especially organic objects, for example, people), then it is clear that the smaller the size of the polygons, the larger they are, the closer the model can be to the original. The tessellation method is based on this: first, a coarse blank is made from a small number of polygons, then a tessellation operation is used, and each polygon is divided into 4 parts. So, if the polygon is quadrangular (or even better, close to square), then the tessellation algorithms give a better and more predictable result. Also, the smoothing operation, and this is the same tessellation, only with a change in the angles to more obtuse, with polygons close to the square, allows you to get a good result.

As mentioned above, the more polygons, the more a model can (maybe because the model should still be similar to the original, and this is a question of the skill of the modeler, not polygons) resemble the original. But a large number of polygons have a downside: a decrease in performance. The more polygons, the more points on which they are built, the more data the processor has to process. Therefore, 3D graphics is always a trade-off between model detailing and performance. In this regard, even the following terms have arisen: hight poly and low poly, respectively, a high polygonal model and a low polygonal model. Low polygonal models are used in games, as they are rendered in real time. By the way, models in games are represented by triangles to improve performance: at the hardware level, GPUs can quickly process hundreds of millions of triangles per second.

As a rule, polygonal modeling refers to hollow modeling, where an object has only volume, but inside is empty. This means that if we model the cube, and then remove one of the walls, we will see a void inside. There are also programs for solid modeling, where the same cube is represented as a monolithic object. In such programs (for example, Autodesk Inventor), mathematical models are used that are different from those in polygonal modeling. Algorithms for solid modeling are better suited for modeling mechanisms in the development of technology. Programs like Autodesk Inventor have the tools to simulate the process, such as chamfering, drilling holes, dimensioning, tolerances, etc. The resulting models can be immediately sent to a suitable machine for the production of products in metal or other material.
There are also so-called 3D modeling programs (ZBrush, Autodesk Mudbox) in which modeling is reduced (roughly speaking) to the creation of recesses or bumps. Such a technique is similar to how sculptors mold clay - removing unnecessary and adding necessary. Using such programs, you can achieve realistic surface relief, such as wrinkles on the skin or tissue folds. At present, the high poly (and for modeling the model should have a solid number of polygons) realistic models of people and the animal world in general are performed, for the most part, with the use of a modeling program. It is common practice when a model is created using polygonal modeling, and then in the modeling program it is tessellated and small details are added.

But here we have a finished model, say, a tank. But the tank, in fact, it does not quite look like. What is the matter? At this stage, we have only a mathematical model containing data only about the geometric form. But a real object besides the form also has color, density, reflectivity, and, perhaps, odor. The latter is not yet applied in 3D graphics, but everything else can be modeled. Giving the model the desired color and gloss is called texturing, from the word texture.

In general, a texture is a two-dimensional pattern that is superimposed on a 3D model. The texture can be either procedural - generated using an algorithm, or drawn in a graphic editor, or a photo of a real object. With the help of the texture, the pattern and color of the model is set, but the real surface also has other parameters: reflectivity, refraction, relief, opacity, etc. All these parameters are set in the material properties. Those. Material in terms of 3D graphics is a kind of mathematical model describing surface parameters. For example, for water it is necessary to specify transparency and refractive reflecting ability.
Before “applying” the material to the 3D model, it is necessary to create its scan, i.e. to represent all (several, one) surfaces as a projection onto a plane. This is necessary so that then the two-dimensional texture correctly "lyagl" on the model.
Thus, the manufacture of a 3D model generally consists of the following stages:
1. Obtaining images of reference (that is, from what will be modeled) or the reference itself. Or drawing an sketch.
2. Modeling geometry based on the reference.
3. Creating a sweep.
4. Drawing textures or getting them in another way as files.
5. Setting the parameters of the material (texture, refraction, reflection, transparency).
Now the 3D model is ready for visualization - image acquisition.
The first and fourth paragraphs can be omitted if the model is simple, but, as a rule, good results cannot be achieved without all 5 steps.
To summarize
There are significant differences in the process itself between the usual pattern, say, on paper, and the construction of a 3D image. Two-dimensional drawing, as a rule, is created in two stages: sketch and coloring. In 3D graphics, after making the model, it must be placed in the scene to other objects (or in a so-called studio), add lighting, a camera, and only then you can hope to get the final picture. The image in 3D graphics is calculated on the basis of a physical model, as a rule, it is a model of propagation of a ray of light, taking into account reflection, refraction, scattering, etc. Drawing colors we draw shadows, glare, etc., and in three-dimensional graphics we prepare the scene taking into account lighting, materials, geometry, camera properties, the program calculates the final image itself.
Here, for now, that's all. Comments, and especially questions and comments on the merits are welcome.
PS In the following sections (if Habrabeshchu is interested) we will talk in more detail about three-dimensional modeling for games, visualization, modeling of dynamic environments such as water, destruction of an object and affecting the dynamic interaction between 3D objects, history of 3D graphics will be affected.
')