The Basics of Computer Graphics

The Basics of Computer Graphics

August 11, 2023 0 By Pandey Rahul

Computer graphics is the field that creates images on a screen, from Hollywood blockbusters to mobile device icons and symbols.

Evans and Sutherland from the University of Utah invented fundamental rendering and visualization techniques which have since been employed by generations of software developers.

What is a Primitive?

Computer graphics primitives are basic nondivisible graphical elements used for input or output within a graphics system. A two-dimensional primitive could include points or lines; three-dimensional primitives include triangles and polygons. Most other graphics elements can be constructed from these primitives.

Primitives are built-in data types supported by programming languages that store values directly without needing an array or class for memory management purposes.

NetLogo primitives are small software components used to construct longer algorithms or agent-based models, represented by unique color codes, that can be combined into larger software pieces to form longer algorithms or construct complex agent-based models. Primitives feature specific functions like GFX_ScreenClear(), GFX_LineDraw(unit16 x1, unit16 y1) and GFX_RectangleDraw(unit16 x2, unit16 y2, left, right and bottom) for drawing primitive shapes; while CAD or 3D modelling programs may present users with extended primitives including more complex shapes such as cuboids.

What is a Pixel?

Pixels are the smallest component of any digital representation of an image. Though pixels can take any shape, they often form squares which combine to produce blended and detailed colors or images. The number of pixels present on any given display is known as its resolution – higher resolution means higher image quality.

Pixels are typically arranged uniformly across a two-dimensional grid, though there may be exceptions such as LCD screens which use random sampling points for their primary colors to produce staggered grid displays.

Each pixel has its own logical address and is represented in software as an on/off value; monochrome systems typically use only one bit per pixel, while gray scale and color systems employ anywhere from four to 24 bits per pixel, providing up to 16 million different hues. Pixel storage options may include RGB (red, green and blue) or CMYK formats for keeping track of storage needs.

What is a Fragment?

Fragments are outputs from the rasterization stage, representing sample-sized portions of a rasterized primitive typically represented by pixels. Each fragment is checked by GPU to see if its pixels fall within the bounds of triangle being rasterized, so as to pass to subsequent stage.

Fragments contain several attributes used by geometry shaders and fragment shading stages to determine their final color at a pixel’s location, including fragment-normals N, R and S – the primary ones being fragment-normal N, perfect reflector R, and surface normal S.

The GPU interpolates these values from fragment vertices (its coordinates in screen space) using barycentric coordinates, while additionally having depth values, Z-buffer indices for layer and viewport identification and user-defined output variables like “gl_PrimitiveID”, which assigns unique ID numbers assigned by its fragment shader to identify itself but are rarely used by applications.

What is a Vertex?

Vertices are angles-forming points in shapes or figures, typically used to form polygons; each corner of a square, for instance, is considered a vertex. Their plural name is vertices; this term may also refer to points found throughout 2D geometry if associated with those figures or shapes.

Computer graphics is the technology behind everything from realistic movie scenes like Toy Story to icons and images found on smartphones and other electronic devices. Its use is crucial in scientific visualization – using images to understand complex phenomena – as well as CAD/CAM applications, where geometric objects must be correctly represented for modeling and engineering purposes.

Teaching kids how to identify vertices in three-dimensional shapes can prepare them for more advanced mathematics and geometry classes that rely on spatial relationships. One way of encouraging student understanding of this concept is providing tangible examples with various shapes that they can explore together – inviting real world items that display various shapes is an effective way of encouraging questions while familiarizing students with it.