# The theory behind 3D graphics: This is how virtual worlds are created

### Dot product

The dot product is used to determine the angle between 2 vectors. It also plays an important role in frustum culling, in which only the objects are displayed that are within the field of view.

The scalar product is a number that is created by the following combination of the two vectors.

The following applies:

follows from this :

If the scalar product of two vectors is zero, then they are perpendicular to one another. If the vectors enclose an angle greater than 90 ° the dot product is> 0, if the angle is smaller than 90 ° the dot product is <0.

## Technical implementation

After all objects have been defined in the computer, all objects are available as wire models in the computer's memory. Now further steps have to be carried out so that these models can appear on the screen. The software that is responsible for this is called a 3D pipeline. This pipeline can be thought of as a conduit through which all models must flow to get to the screen. The pipelineconsists itself of individual pipelines that are run through one after the other.

The representation of a 3D image requires a large amount of mathematical calculations so that all details of the scene are correctly represented. The pipeline is responsible for these calculations. Let's take a closer look at these individual pipelines.

• Transformation pipeline Here, the models are distributed and aligned in space. The first transformation is the 'world transformation', with this the object is positioned in space. A different transformation is carried out for each object. In the following “view transformation” the position of the objects relative to the viewer is determined. The final transformation is the “perspective transformation”, which is responsible for shaping the scene into a desired perspective (similar to a camera lens).
• Frustum culling/clipping pipeline In This pipeline determines which objects are in the visible area of ​​the screen and which are not. Invisible objects are not calculated and only partially visible objects are cut off at the edges of the screen (clipping).
• Lighting pipeline In order to achieve greater realism, the objects are usually illuminated by light sources. The light intensity is calculated in each area of ​​the object, as well as the highlights that are created by reflections.
• Texturing pipeline After lighting, textures are usually drawn over the objects, these are two-dimensional images with which the surface of the object is described. These textures are combined with the lighting values ​​to ensure realistic shading.
• Hidden Surface Removal Pipeline In this pipeline, the objects that are hidden by others are identified. These hidden objects are thennot drawn to save resources.
• Rasterization Rasterization is the last step in the 3D pipeline. It converts the 3D surfaces into pixels on the screen after they have passed through all of the other pipelines. Nowadays this process is accelerated by the graphics card. After this last step, only the selected section of our 3D world is displayed on the screen with all its details.

On the next page: Future and conclusion