Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Posibnik_dlya_2_KURSU1docx.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
3.7 Mб
Скачать

Graphic Models and Engines

Modern applications (such as drawing programs and games) go well beyond simple two-dimensional objects. Indeed, multimedia developers typically use graphics engines designed to work with C++ or Java. A graphics engine provides a way to de­ne and model 2D and 3D polygons. (Curves can be constructed by specifying “control points” for bicubic curves.)

Complex objects can be built up by specifying hierarchies (for example, a human fi­gure might consist of a head, neck, upper torso, arms, hands, lower torso, legs, feet, and so on). By creating a hierarchy of arm, hand, fi­ngers a transformation (scaling or rotation) of one object can be propagated to its dependent objects. In many cases graphics are created from real-world objects that have been digitally photographed or scanned, and then manipulated.

In most scenes the relationships between graphical objects are also important. Modern graphics modeling programs use a virtual “camera” to indicate the position and angle from which the graphics are to be viewed. In rendering the scene, the Painter’s Algorithm can be used to sort objects and draw closer surfaces on top of farther ones, as a painter might paint over the background. Alternatively, the Z-buffer algorithm stores depth information for each pixel to determine which ones are drawn. This technique requires less calculation (because surfaces don’t need to be sorted), but more memory, since the depth of each pixel must be stored.

Within a scene, the effects of light (and its absence, shadows) must be realistically rendered. A simple technique can be used to calculate an overall light level for an object based on its angle in relation to the light source, plus a factor to account for ambient and diffuse light in the environment. The Gouraud shading technique can be used to smooth out the artifacts caused by the simple flat shading method. Another technique, Phong shading, can more realistically reproduce highlights (the sharp image of a light source being reflected within a surface). But the most realistic lighting effects are provided through ray tracing, which involves tracing how representative vectors (representing rays of light) reflect from or refract through various surfaces. However, ray tracing is also the most computationally intensive lighting technique.

Several techniques can be used to give objects more realistic surfaces. Texture mapping can be used to “paint” a realistic texture (perhaps scanned from a real-world object) onto a surface. For example, pieces in a chess game could be given a realistic wood grain or marble texture. This can be further re­fined through bump mapping, which calculates variations in the texture at each point based on light reflections.

The most graphics-intensive applications today are games, multimedia programs, and scientifi­c visualization or modeling applications. Because of the impact graphics have on users’ perception of games and multimedia programs, developers spend a high proportion of their resources on graphics.

Harry Henderson

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]