EnglishРусскийTürkçeDeutschFrançais About · RSS
WebInterface.org
WebInterface.org

Notes on drawing, print, photographs, and pictures made by computer.

Home · Computer graphics · From a model to a pixel

From a model to a pixel

The ordinary vocabulary of computer graphics is easy to slide past, because each word also has a plain English meaning. In this subject the words are tighter than that.

Pixel, primitive, image

In digital imaging a pixel, a picture element, is a single point in a raster image. Pixels sit on a regular two-dimensional grid and are often drawn as dots or squares. Each pixel is a sample of an original image. More samples usually give a more accurate account of that original. The intensity of a pixel varies. In a colour system a pixel typically has three subpixels, red, green, and blue. Enlarge a digital photograph far enough and the squares stop pretending to be a continuous tone. That is not a fault in the display. It is the representation, seen at the wrong distance.

A primitive is a basic unit a graphics system combines into a more complex image or model. In a 2D game the primitives may be sprites and character maps. In CAD they are the geometric primitives the modeller offers. In 3D rendering they are polygons, very often triangles. Hardware may support a primitive directly, because drawing it in silicon is faster than building it from a program every time. Or the primitive is only a convenience the application provides, and the hardware sees something simpler underneath.

A digital image is either a vector image or a raster image. Rasters are the more common of the two. The image may have come from a camera, or from an optical instrument, or from a calculation that never involved a lens. Once a representation is chosen, it still has to become light on a screen.

Rendering

Rendering is the generation of a 2D image from a 3D model by means of a computer program. A scene file holds the objects in a defined language or data structure: geometry, viewpoint, texturing, lighting, and shading, as a description of a virtual scene. That data is passed to a rendering program and comes out as a digital image, a raster file. The renderer is usually built into the graphics software. Some are plugins. Some are separate programs. The word is an analogy with an artist's rendering of a scene, a picture made from a description rather than from sitting in front of the thing.

The technical methods differ. The general problem does not. You have a three-dimensional description and you need a two-dimensional picture. The steps along that path, on a device such as a GPU, are called the graphics pipeline. A GPU is a device that assists the CPU with the calculation. If the scene is meant to look reasonably realistic and predictable under virtual lighting, the software has to take account of the rendering equation. That equation does not cover every lighting phenomenon. It is a general lighting model for computer-generated imagery, not a complete theory of optics. "Rendering" is also the word used when a video editing program calculates effects out to a finished file. Same word, narrower job: there the geometry is already a sequence of frames, and the program is combining them.

Projection, rays, shade

3D projection maps three-dimensional points onto a two-dimensional plane. Most current displays are flat, so this projection is everywhere. Real-time 3D applications typically do it by rasterization: the projected polygon covers some pixels, and those pixels get painted. Rasterization asks, for each polygon, which pixels it covers. Ray tracing asks, for each pixel, what the light did.

Ray tracing is one of the image-order algorithms. It generates a picture by following the path of light through pixels in an image plane. It can reach a high degree of photorealism, usually higher than typical scanline rendering, and the cost is higher too. For a long time that cost kept it off interactive machines. The cost moved. The idea did not.

Shading is how depth is depicted by varying darkness. Draughtspeople already knew the word. You put the medium down more densely, or in a darker colour, where the form turns away from the light, and more lightly where it faces the light. Cross-hatching is one technique: perpendicular lines in a grid, closer together where the passage should read as darker. In computer graphics the word widened. It now also means that shaders are applied, those small programs whose job is to decide the colour of a sample. A shader can imitate cross-hatching. It can also do things no pen can, because it knows the surface normal and the lights as numbers.

Texture, aliasing, volume

Texture mapping adds detail, surface texture, or colour to a generated graphic or a 3D model. Edwin Catmull applied it to 3D graphics in 1974. A texture map is laid onto the surface of a shape or a polygon. The usual comparison is patterned paper wrapped around a plain white box. It is a good comparison, and it fails in one place: the paper wrinkles, and a texture map can be told not to. Multitexturing uses more than one texture on a polygon at once. Procedural textures are produced by adjusting the parameters of an algorithm. Bitmap textures are painted in an image editor or taken from a camera. Placing a texture on a polygon surface usually requires UV mapping, a manual layout of texture coordinates. NURBS surfaces carry their own parameterization, which can serve as those coordinates without a separate unwrap.

The same heading covers normal maps and bump maps, which fake height, specular maps, which fake shine, and environment maps, which fake a mirror. None of these change the fact that the underlying surface may be a coarse mesh. They change what the lighting calculation believes about that surface.

Drawing a resolution-independent object, such as a 3D model, onto a raster device such as an LCD or a CRT produces aliasing. The artifacts sit mostly along geometric edges and along the boundaries of texture detail. Informally they are jaggies. Anti-aliasing methods reduce them. The picture is easier on the eye, and the calculation costs something. Supersampling is one family of methods. An artist choosing a setting is choosing a point on that trade. A bitmap texture that was prepared at one resolution and is shown at another, a textured model far from the camera for example, will alias. A procedural texture can alias at any resolution, because it has no pixels of its own until it is sampled. Mipmapping and texture filtering are the usual remedies for the texture case. They do not make the problem philosophical. They make the sample match the size it is being drawn at.

Volume rendering displays a 2D projection of a 3D set of samples. A typical set is a stack of slice images from a CT or MRI scanner, taken on a regular spacing, each slice itself a regular grid of pixels. Each volume element, or voxel, holds a single value sampled from its immediate neighbourhood. Colour can then be assigned by tissue, so that bone, muscle, and vessels read as separate in the projection. It is rendering, and it is not the same job as rendering a modelled character. There may be no surface in the data until the renderer decides where one should appear.

Three-dimensional computer graphics is what you have once the primitives are a model of a solid rather than a flat mark. The vocabulary stays the same. The amount of data it has to cover does not.

Earlier: Flat pictures: pixels, sprites, and vectorsLater: Were VR graphics ahead of their time?