Computer Graphics Review Notes
(Personal finishing, only do review with:D, reproduced annotated Source: http://blog.csdn.net/hcbbt/article/details/42779341)
The first chapter of computer graphics summary
Chapter II Overview of graphic systems
Video display device
Refresh CRT
- Most video monitor operations are standard-based cathode ray tubes (CRT)
- CRT electron gun, focusing system, acceleration electrode, deflection system, screen composition
- The screen glows by collecting an electron beam through a fluorescent substance.
- Continuous glow Time: When the electron beam leaves a point, the luminance value of the point decays to the initial value of 1/10 of the time required
- refresh rate : The number of times to redraw the screen per second: The minimum refresh frequency required for the CRT to produce a stable image = 1 seconds/duration of fluorescence material
- Pixel: The smallest element that makes up a screen (image)
- Resolution: The maximum number of pixels that the CRT can recognize in horizontal or vertical units of length, usually dpi
Raster Scan Display
- Scan line, in the raster scanning system, the electron beam transverse scan screen, one line, from top to bottom, each line is called a scan line;
- Frame, frame refers to the entire screen range;
- Frame cache or refresh the cache, the graphical definition is stored in a memory called flush cache or frame cache, which holds a set of intensity values corresponding to all points on the screen, and the intensity value of the beam is removed from the refresh cache or the frame cache when the electrons are moved point-by-step on the screen.
- Cache depth or bit plane number, the number of bits per pixel is called the cache depth or bit plane number;
- Bitmap, a per-pixel frame cache is often referred to as a bitmap;
- Pixel graph, multi-bit frame cache per pixel is called pixel graph;
- Horizontal back sweep, after each scan line is refreshed, the electron beam returns to the left end of the screen, called the horizontal sweep of the electron beam;
- Vertical sweep, at the end of each frame, the electron beam returns to the upper-left corner of the screen, beginning to show the next frame, called the vertical sweep of the electron beam;
- Interlaced scanning, first starting from line No. 0, scanning every other row, the even line is scanned after the vertical sweep, the electron beam starts from line 1th scan all odd lines.
Random Scan Display
- The electron beam only displays part of the graphic on the screen. The electron beam tracks the composition lines of the graph, creating a line chart.
- Refresh display file: The flush rate of the random scan system depends on the number of lines displayed.
- Color CRT monitor
- Electron beam penetration: an anti-recurrence display of color graphics coated with different layers of fluorescent powder on the screen, the emission color is determined by the penetration depth of the electron beam in the fluorescence layer.
- Shadow Mask Method: Commonly used in grating scanning system, it can produce a color range than the electron beam penetration method much larger
- Flat Panel Display
- Divided into: Transmitter display (not practical) and non-transmitting display (LCD)
- Three-dimensional observation equipment
Grating Scanning system
- Advantages:
- Low cost
- Easy to draw filled graphics
- Color Rich
- Refresh frequency must be irrelevant to the complexity of the graph
- Easy to modify graphics
- Disadvantages:
- Scan conversion Required
- will create confusion (aliasing)
- Normal graphics card = Video Controller + cache (memory)
- Graphics accelerator card = Video Controller + memory + Display Processor (GPU)
Input device
- Two-dimensional: mouse, coordinate digitizer, tracking ball, stylus, touch screen, joystick, scanner.
- Three-dimensional: space ball, data glove.
Hard copy Device
- Long-term Save graphics
- Example: Plotter, printer
Graphics software
- Coordinate representation:
- World coordinate system: Usually the world coordinate system is a three-dimensional Cartesian coordinate system. It is a global coordinate system, usually a right-handed coordinate.
- Modeling coordinate system (local coordinate system): a two-dimensional or three-dimensional Cartesian coordinate system defined independently of the world coordinate system is called a local coordinate system for the sake of geometrical modeling and observing objects.
- Device coordinate system or screen coordinate system: the screen coordinate system is also known as the device coordinate system, which is used primarily for the definition of a point on a particular computer graphics display device, such as a raster display.
- Device coordinates, normalized coordinates, world coordinates, modeling coordinates
- The basic building blocks of a graph are called output elements
- The modeling transformation uses the object description given by the modeling coordinates to form the scene
- observation transforms are used to specify the view to be displayed and the range that appears in the output display area
- Main Tasks :
- Vertex datasets for modeling (Modeling) objects
- The geometry processing (geometric processing) object is a vertex, including: projection, element assembly, Clipper, shading
- Rasterize or Scan Transformations (rasterization) generate fragments from cropped objects
- Chip handling (Fragment processing)
Opengl
Chapter Three output elements
Fourth. Attributes of an entity
Colors and Lookup Tables
- Color is a basic property of all entities
- In color grating systems, the number of colors available depends on the storage capacity provided in the frame cache.
- Color information has two storage methods: direct storage of RGB encoding. Store Color codes (lookup table)
- Use a color table to provide a reasonable number of simultaneous displays
The properties of the point
Properties of the line
- Line width
- Brushes and paint brushes
- Linear
Fill Area Properties
- Fill mode
- Color Blend Fill Area
Universal Scan Line filling algorithm
- The scanning line algorithm is to calculate the intersection interval of scan line and polygon according to the scanning line order, and then display the pixels of these intervals with the required color to complete the conversion work. The endpoints of the interval can be obtained by calculating the intersection of the scan line and the polygon boundary.
- For a scan line, the scanning conversion process for polygons can be divided into four steps:
- Intersection: Calculates the intersections between the scanned lines and the polygon edges;
- Sort: Sorts all intersections in ascending order of X-values;
- Pairing: The first with the second, the third and the fourth, and so on; each pair of intersections represents an intersection of a scan line and a polygon,
- Coloring: The pixels in the intersection interval are placed into a polygon color, and the pixels outside the intersecting interval are placed into the background color.
Irregular boundary Area Fill method
- recursive algorithm
void flood_fill_4 (int x, y, Old_color, fill_color) {int current; Current = Read_pixel (x, y); if (current = = Old_color && Current! = Fill_color) {write_pixel (x, y, Fill_color); Flood_fill_4 (x-1, y, Old_color, Fill_color); /* Left */flood_fill_4 (x, y + 1, old_color, Fill_color); /* On */flood_fill_4 (x + 1, y, Old_color, Fill_color); /* Right */flood_fill_4 (x, Y-1, Old_color, Fill_color); /* below */}}
- Scan line algorithm demo
void Scanline(int x, int y) { if (x < 0 || x >= ROW || y < 0 || y >= COL || vis[x][y]) return; int xl = 0, xr = 0, i; drawPoint(x, y, 2); for (xl = x - 1; xl >= 0; xl--) { if (!vis[xl][y]) drawPoint(xl, y, 2); else break; } for (xr = x + 1; xr < ROW; xr++) { if (!vis[xr][y]) drawPoint(xr, y, 2); else break; } for (i = xl + 1; i < xr; i++) { Scanline(i, y - 1); Scanline(i, y + 1); }}
Anti-aliasing
- Aliasing
- The distortion caused by a continuous amount (graph) in discrete quantities (pixels), called confusion or aliasing (aliasing).
- The aliasing phenomenon of raster graphics:
- Ladder-like boundary;
- Distorted graphic details;
- Small graphics lost: The animation sequence is hidden and flashing.
Fifth chapter geometric transformations
- Mathematical basis of matrix operation
Basic two-dimensional geometric transformations
- Panning
x‘=x+tx, y‘=y+ty
- Rotate
x‘=xcosθ-ysinθ, y‘=xsinθ+ycosθ
- Zoom
x‘=sxx, y‘=syy
Matrix representation and homogeneous coordinates
- Homogeneous coordinates: Using n+1 dimension to represent n-dimensional vectors
Inverse transformation
- Inverse matrix of the translation transform T (tx,ty) is T (-tx,-ty)
- Inverse matrix of rotation transform R (θ) is R (-θ)
- The inverse matrix of the scaling transform s (sx,sy) is S (1/sx,1/sy)
Two-dimensional composite transformation
- Matrix multiplication is not exchangeable
- The efficient implementation of composite two-dimensional transformation should be: first, by using matrix multiplication, several basic two-dimensional transformation matrices are combined into a composite two-dimensional transformation matrix, and then the transformed coordinates are computed.
Other two-dimensional transformations
- Symmetric transformations
- Split-cut transformation
Transformation between two-dimensional coordinate systems
- Steps:
- Translates the coordinate origin of the X ' Y ' system to the origin of the XY system.
- Rotate the x ' axis onto the x-axis.
M = R(- θ)*T(-x0,-y0)
Geometric transformation of three-dimensional space
Three-dimensional composite transformation
- Matrix multiplication Merge
- The rightmost matrix is the first transformation that acts on an object, and the leftmost matrix is the last
Transformation between three-dimensional coordinate system
Affine transformations
- Translation, rotation, scaling, reflection, and error cutting are special cases of two-dimensional affine transformations
The sixth chapter two-dimensional observation
Two-dimensional observation line
- The area to be displayed in the world coordinate system is called a window (clipping window)
- The area that the window maps to the display is called a viewport.
- The window defines what is displayed, and where the viewport definition appears.
- An operation that typically maps a portion of a world coordinate system to a device coordinate system is called an observation transformation.
- Device coordinates, normalized coordinates, world coordinates, modeling coordinates
OpenGL Two-dimensional observation function
gluOrtho2D(xwmin, xwmax, ywmin, ywmax);glViewport(xvmin, yvmin, width, height);
Clipping of two-dimensional points
-
xwmin <= x <= xwmax;
ywmin <= y <= ywmax;
The point is preserved if satisfied.
Clipping of two-dimensional lines
- Cohen-sutherland algorithm
- Basic idea:
- If the two endpoints of the line are P1P2 completely inside the window, the segment is displayed p1p2, for short, "take"
- If the two endpoints of the line p1p2 clearly outside the window, the segment is discarded, for short, "Discard"
- Line clipping
- Area code
位 4 3 2 1坐标区 上 下 右 左
- It is very convenient to use area code, detailed algorithm analysis
- Midpoint segmentation algorithm
- Also use area code
- Basic ideas The first two steps are the same as the Cohen-sutherland algorithm:
- 3 Midpoint Segmentation method to find the intersection between the line segment and the window: that is, from the P0 point to locate the closest visible point from P0 A and from the P1 point to find the closest visible point from P1 B, two visible points between the lines is the visible part of the segment p0p1.
- Comparison of Cohen-sutherland algorithm and midpoint segmentation algorithm
- Cyrus-beck algorithm
- The line segment is represented as a parametric equation, and the parameters of the intersection point of the segment and the window boundary are determined, and the visible part of the segment is calculated and the intersection coordinates are computed by the parameters of the intersection.
- Suitable for convex polygon cropping window
- Liang Youdong-barsky algorithm
- simplified parametric re-processing
up<=q
- The second part of the detailed algorithm analysis
- NLN algorithm
- Basic idea:
- To the four corners of the window to be treated with a ray of light
The seventh chapter three-dimensional observation
-
Three-dimensional observation concept Overview
- projection
- depth
- visible lines and meeting decisions
-
Three-dimensional observation pipeline
- Model coordinates--(modeling transformations), world coordinates (see transformations), observation coordinates---projection transformation-- > (normalized transformations and cropping), normalized coordinates---(viewport transform), device coordinates
-
Three-dimensional observation coordinate parameters
- observation Point (observation position, viewpoint, camera position)
- watch up vector
-
Transformation of the world coordinate system to the viewing coordinate system
-
M = R * T
- T (-x0,-y0,-z0)
- R (UVN) (see ' Three-dimensional coordinate system ' Transform ')
-
projection transform
- A projection transformation is the transformation of a point with a dimension n to a point where the dimension is less than N.
- Type:
- parallel projection
- perspective projection
- Spherical projection
- cylindrical projection
-
positive projection
- axis side positive projection
-
oblique projection
- when the projection path is not perpendicular to the observation plane, the map is called oblique parallel projection
-
Perspective projection
Eighth three-dimensional object representation
The Nineth chapter can meet the discriminant algorithm
Visible face discrimination (hidden face elimination) algorithm
- Category: Object space and image space
- Improve algorithmic performance with sequencing and coherence
Discrimination of Back-face Detection in the posterior face
- Thought:
- Ax+by+cz+d=0
- If the point (x, Y, z) is a point on the line of sight and satisfies the ax+by+cz+d <0
- The plane is a back face
- Test method: Polygon plane normal vector n * line of sight vector v > 0, then back face
Depth-buffer Method Depth Buffering algorithm
- Thought: Comparing the surface depth of each pixel on the projection plane
- belongs to the image space algorithm
- Algorithm:
- Initialize the frame cache and the depth
depthBuff(x, y) = 1.0
cache ,frameBuff(x, y) = backgndColor
- Handle each object in the scene: Calculate the depth of each point , and if so
z < depthBuff(x, y)
, update
A-buffer method A-Buffering algorithm
- The basic method is to extend the depth buffer so that each pixel position corresponds to a surface linked list
- Each cell contains two domains: Depth field, intensity field
Scan-line method Scanning Line algorithm
- The surface of the mesh is projected onto the projection plane, and the intersection interval between the scan line and the projected polygon is computed. The intersecting interval belongs to the same surface, the color information of the surface is displayed directly, and the depth test is used to determine which surface strength information is used when overlapping intervals occur.
Depth-sorting method Depth-sorting algorithm
- If any polygon surface in the scene does not penetrate or loop through the depth, the order of precedence of each polygon is fully determined
- Algorithm:
- Sort the surface in descending direction of depth
- The surface is scanned and converted, starting with the largest surface of the depth
OpenGL Section
A big problem, the main study of the basic graphics application and OpenGL programming framework master.
OpenGL statements, only need to understand, do not need to remember.
Computer Graphics Review Notes