Anti-aliasing (反锯齿处理)
简单地说主要是应用调色技术将图形边缘的“锯齿”缓和,边缘更平滑。反锯齿是相对来来说较复杂的技术,一直是高档加速卡的一个主要特征。目前的3D加速卡大多不支持反锯齿,但在下一代3D加速卡如RIVA TNT、G200中将支持这项技术。
Alpha Blending ( Alpha 值混合处理)
Alpha Blending是一种使物体透明化的技术。通常当一个3D物体在屏幕上显现时,其每个象素都会有红黄蓝三个数值进行控制。如果当前的3D环境能够提供一组额外的alpha值,那么我们就称它拥有一个alpha channel。Alpha的内容是记录象素的透明度。比如说在水中水中游泳的劳拉,水和人各有不同的Alpha 值(水的alpha较低),当劳拉跳入水中后,如果当前硬件环境支持alpha混合,那么当两者结合时就会将alpha值进行运算。最终我们看到的是两者在重叠部分会得到模糊化处理的效果。由于alpha值的介入,使得我们在游戏中采能够得到接近现实的虚拟透明效果。
加速图形端口(AGP):
一种可自由扩展的图形总线结构,能增大图形控制器的可用带宽,并为图形控制器提供必要的性能,以便在系统内存里直接进行纹理处理。这是一种新的接口标准,在物理结构上与PCI存在显著区别,专为图形控制器设计。它同时使用了卡上帧缓冲内存与系统内存。
深度效果处理(Depth Cueing):
根据离观察者的距离,改变物件的颜色强度和亮度。例如,即使一个闪亮、鲜艳的红球,如果越来越远离观察者,也会变得越来越阴暗。
雾化效果(Fogging):
雾化效果是3D的比较常见的特性,在游戏中见到的烟雾、爆炸火焰以及白云等效果都是雾化的结果。它的功能就是制造一块指定的区域笼罩在一股烟雾弥漫之中的效果,这样可以保证远景的真实性,而且也减小了3D图形的渲染工作量。
Texture Mapping (材质贴图):
是在物体着色方面最引人注意、也是最拟真的方法,同时也多为目前的游戏软件所采用。一张平面图像(可以是数字化图像、小图标或点阵位图)会被贴到多边形上。例如,在赛车游戏的开发上,可用这项技术来绘制轮胎胎面及车体着装。
Mip Mapping (Mip贴图):
这项材质贴图的技术,是依据不同精度的要求,而使用不同版本的材质图样进行贴图。例如:当物体移近使用者时,程序会在物体表面贴上较精细、清晰度较高的材质图案,于是让物体呈现出更高层、更加真实的效果;而当物体远离使用者时,程序就会贴上较单纯、清晰度较低的材质图样,进而提升图形处理的整体效率。
Bump Mapping (凹凸贴图):
这是一种在3D场景中模拟粗糙外表面的技术。将深度的变化保存到一张贴图中,然后再对3D模型进行标准的混合贴图处理,即可得到具有凹凸感的表面效果。
Video Texture Mapping ( 视频材质贴图):
这是目前最好的材质贴图效果。具有此种功能的图形图像加速卡,采用高速的图像处理方式,将一段连续的图像(可能是即时运算或来自一个AVI或MPEC的档案)以材质的方法处理,然后贴到3D物件的表面上去。
双线MIP贴图(Bilinear MIP Mapping):
双线过滤和MIP贴图的一种组合形式。首先保存好一张纹理贴图的几个副本。接着,选中最接近选择的贴图。最后,求选中贴图最接近的四个质素的加权平均值。
双线过滤/插补(Bilinear Filtering/Interpolation):
这是一种较好的材质影像插补的处理方式,会先找出最接近像素的四个图素,然后在它们之间作差补效果,最后产生的结果才会被贴到像素的位置上,这样不会看到“马赛克”现象。这种处理方式较适用于有一定景深的静态影像,不过无法提供最佳品质,也不适用于移动中的物件。画面由于采用了“双线过滤”,图像显得非常“柔和”。
Nearest Neighbor (近邻取样)
是一种较简单材质影像插补的处理方式。会使用包含像素最多部分的图素来贴图。换句话说就是哪一个图素占到最多的像素,就用那个图素来贴图。这种处理方式因为速度比较快,常被用于早期3D游戏开发,不过材质的品质较差。
Trilinear Interpolation (三线过滤处理):
这是一种更复杂材质影像插补处理方式,会用到相当多的材质影像,而每张的大小恰好会是另一张的四分之一。例如有一张材质影像是512×512个图素,第二张就会是256×256个图素,第三张就会是128×128个图素等等,总之最小的一张是1×1。凭借这些多重解析度的材质影像,当遇到景深极大的场景时(如飞行模拟),就能提供高品质的贴图效果。一个“双线过滤”需要三次混合,而“三线过滤”就得作七次混合处理,所以每个像素就需要多用21/3倍以上的计算时间。还需要两倍大的存储器时钟带宽。但是“三线过滤”可以提供最高的贴图品质,会去除材质的“闪烁”效果。对于需要动态物体或景深很大的场景应用方面而言,只有“三线过滤”才能提供可接受的材质品质。
Perspective Correction (透视角修正处理)
它是采用数学运算的方式,以确保贴在物件上的部分影像图,会向透视的消失方向贴出正确的收敛。在图3中,当图形画面向前倾斜时,左边的画面由于采用了“透视角修正”技术,画面上的直线保持真实的透视效果;而右边的画面没有采用“透视角修正”技术,因而画面上的直线出现了失真。
Z Buffer (Z 缓存)
Z-buffering是在为物件进行着色时,执行“隐藏面消除”工作的一项技术,所以隐藏物件背后的部分就不会被显示出来。
在3D环境中每个像素中会利用一组数据资料来定义像素在显示时的纵深度(即Z轴座标值)。Z Buffer所用的位数越高,则代表该显示卡所提供的物件纵深感也越精确。目前的3D加速卡一般都可支持16位的Z Buffer,新推出的一些高级的卡已经可支持到32位的Z Buffer。对一个含有很多物体连接的较复杂3D模型而言,能拥有较多的位数来表现深度感是相当重要的事情。
Double Buffering (双重缓冲区处理)
绝大多数可支持OpenGl的3D加速卡都会提供两组图形画面信息。这两组图形画面信息通常被看着“前台缓存”和“后台缓存”。显示卡用“前台缓存”存放正在显示的这格画面,而同时下一格画面已经在“后台缓存”待命。然后显示卡会将两个缓存互换,“后台缓存”的画面会显示出来,且同时再于“前台缓存”中画好下一格待命,如此形成一种互补的工作方式不断地进行,以很快的速度对画面的改变做出反应。
RAMDAC(存储器数模转换速度)
表示将存储器图形数据转换成显示器上可见的像素光点的转换速度,单位为MHz,其工作速度越高,频带越宽,高分辨时的画面质量越好。
高洛德上色(Gouraud Shading):
一种光影渲染技术。它将照明模型应用于一个多边形的每个顶点,然后在整个表面铺开。结果便是一个平滑渐变的表面。
图形函数库(Graphics Library):
图形处理函数与子例程的一个集合,程序员可用它作为接口,方便地调用低级任务。
锯齿(Jaggies):图像的锯齿效果,由映射失真造成。
照明模型(Lighting Model):一种图形处理公式,用于模拟灯光照射到物件表面的效果。
三元荧(Phosphor triad):构成一个像素的三个荧光体,分别能发出红光、绿光或蓝光。
像素(Pixel):Picture Element(图形元素)的简称,屏幕颜色与强度的一个单位。像素其实是能够定址和分配颜色值的最小单位。
光栅(Raster):由像素构成的一个矩形网格。要在光栅上显示的数据保存于帧缓存内。
3D API
API是Application Programming Interface应用程序接口的缩写,是许多程序的大集合。一个3D API能让编程人员所设计的3D软件只要调用其API内的程序,从而让API自动和硬件的驱动程序沟通,启动3D芯片内强大的3D图形处理功能,从而大幅度地提高了3D程序的设计效率。目前普遍应用的3D API有DirectX、OpenGL、Glide、Heidi。
•DirectX
微软公司专为PC游戏开发的API,与Windows 95 和Windows NT操作系统兼容性好,可绕过图形显示接口(GDI)直接进行支持该API的各种硬件的底层操作,大大提高了游戏的运行速度,而且目前基本上是免费使用的。由于要考虑与各方面的兼容性,DirectX用起来比较麻烦、在执行效率上也未见得最优。具体组成及功能详情可参看本报第33期(8月31日)“Microsoft DirectX 6.0演武传奇”一文。
•OpenGL (开放式图形接口)
由Silicon Graphics公司开发,能够在Windows 95、Windows NT、Macos、Beos、OS/2、以及Unix上应用的API。由于OpenGL起步较早,一直用于高档图形工作站,其3D图形功能很强,超过
DirectX,能最大限度地发挥3D芯片的巨大潜力。在Windows 98中已经支持Direct X和OpenGL。在OpenGL的1.2版中增加了对3DNow!标准的支持。
•Glide
这是3Dfx公司为VOODOO系列3D加速卡设计的专用3D API,它可以最大限度发挥VOODOO系列芯片的3D图形处理功能,由于不考虑兼容性,其工作效率远比OpenGL和Direct 3D高,所以Glide是各3D游戏开发商优先选用的3D API。不过,这样一来就使得许多精美的3D游戏在刚推出时,只支持3Dfx公司的VOODOO系列3D加速卡,而其它类型的3D加速卡则要等待其生产厂商提供该游戏的补丁程序。
•Heidi
Heidi是一个由Autodesk公司提出来的规格。目前,采用Heidi系统的应用程序包括3D Studio MAX动画制作程序、Autodesk公司为 AutoCAD R13开发的WHIP加速驱动程序。
———————————————————————————————————————
2D Graphics
Displayed representation of a scene or an object along two axes of reference: height and width (x and y).
3D Graphics
Displayed representation of a scene or an object that appears to have three axes of reference: height, width, and depth (x, y, and z).
3D Pipeline
The process of 3D graphics can be divided into three-stages: tessellation, geometry, and rendering. In the tessellation stage, a described model of an object is created, and the object is then converted to a set of polygons. The geometry stage includes transformation, lighting, and setup. The rendering stage, which is critical for 3D image quality, creates a two dimensional display from the polygons created in the geometry stage.
Alpha Blending
The real world is composed of transparent, translucent, and opaque objects. Alpha blending is a technique for adding transparency information for translucent objects. It is implemented by rendering polygons through a stipple mask whose on-off density is proportional to the transparency of the object. The resultant color of a pixel is a combination of the foreground and background color.
Typically, alpha has a normalized value of 0 to 1 for each color pixel.
new pixel = (alpha)(pixel A color) + (1 - alpha)(pixel B color)
Alpha Buffer
An extra channel to hold transparency information; pixels become quad values (RGBA). In a 32-bit frame buffer there are 24 bits of color, 8 each for red, green, and blue, along with an 8-bit alpha channel.
Anti-aliasing
Anti-aliasing is subpixel interpolation, a technique that makes edges appear to have better resolution.
Atmospheric Effect
Effects, such as fog and depth cueing, that improve the rendering of real-world environments.
Bitmap
A Bitmap is a pixel by pixel image.
Bilinear Filtering
Bilinear filtering is a method of anti-aliening texture maps. A texture-aliening artifact occurs due to sampling on a finite pixel grid. Point-sampled telexes jump from one pixel to another at random times. This aliening is very noticeable on slowly rotating or moving polygons. The texture image jumps and shears along pixel boundaries. To eliminate this problem, bilinear filtering takes a weighted average of four adjacent texture pixels to create a single telex.
BitBLTs
The BitBLT is the single most important acceleration function for windowed GUI environments. A BitBLT is simply the movement of a block of data from one place to another, taking into account the special requirements and arrangements of the graphics memory. For example, this function is utilized every time a window is moved; in which case, the BitBLT is a simple Pixel Block Transfer. More complicated cases may occur where some transformation of the source data is to occur, such as in a Color Expanded Block Transfer, where each monochromatic bit in the source is expanded to the color in the foreground or background register before being written to the display.
Blending
Blending is the combining of two or more objects by adding them on a pixel-by-pixel basis.
Bus Mastering
A feature of PCI buses that allows a card with this feature to retrieve data directly from system memory without any interaction with the host CPU
Chroma Keying
Chroma Keying or texture transparency is the ability to recognize a key color within a texture map and make it transparent during the texture mapping process. Since not all objects are easily modeled with polygons, chroma keying is used to include complex objects in a scene as texture maps.
Depth Cueing
Depth cueing is the lowering of intensity as objects move away from the viewpoint.
Dithering
Dithering is a technique for archiving 24-bit quality in 8 or 16-bit frame buffers. Dithering uses two colors to create the appearance of a third, giving a smooth appearance to an otherwise abrupt transition.
Double Buffering
A method of using two buffers, one for display and the other for rendering. While one of the buffers is being displayed, the other buffer is operated on by a rendering engine. When the new frame is rendered, the two buffers are switched. The viewer sees a perfect image all the time.
DRAM
Dynamic Random Access Memory is the memory at any location in a computer that can be accessed immediately for reading and writing operations.
EDO DRAM
A type of DRAM that has enhanced readability in the Extended-Data-Out mode.
Flat Shading
The flat shading method is also called constant shading. For rendering, it assigns a uniform color throughout an entire polygon. This shading results in the lowest quality, an object surface with a faceted appearance and a visible underlying geometry that looks \'blocky\'.
Fog
Fog is the blending of an object with a fixed color as its pixels become farther away from the viewpoint.
Gamma
The characteristics of displays using phosphors (as well as some cameras) are nonlinear. A small change in voltage when the voltage level is low produces a change in the output display brightness level; but this same small change in voltage at a high voltage level will not produce the same magnitude of change in the brightness output. This effect, or actually the difference between what you should have and what you actually measured, is known as gamma.
Gamma Correction
Before being displayed, linear RGB data must be processed (gamma corrected) to compensate for the gamma (nonlinear characteristics) of the display.
Gouraud Shading
Gouraud shading, one of the most popular smooth shading algorithms, is named after its French originator, Henri Gouraud. Gouraud shading, or color interpolation, is a process by which color information is interpolated across the face of the polygon to determine the colors at each pixel. It assigns color to every pixel within each polygon based on linear interpolation from the polygon\'s vertices. This method improves the \'blocky\' (see Flat Shading) look and provides an appearance of plastic or metallic surfaces.
Hidden Surface Removal
Hidden Surface Removal or visible surface determination entails displaying only those surfaces that are visible to a viewer because objects are a collection of surfaces or solids.
Interpolation
Interpolation is a mathematical way of regenerating missing or needed information. For example, an image needs to be scaled up by a factor of two, from 100 pixels to 200 pixels. The missing pixels are generated by interpolating between the two pixels that are on either side of the pixel that needs to be generated. After all of the \'missing\' pixels have been interpolated, 200 pixels exist where only 100 existed before, and the image is twice as big as it used to be.
Lighting
There are many techniques for creating realistic graphical effects to simulate a real-life 3-D object on a 2-D display. One technique is lighting. Lighting creates a real-world environment by means of rendering the different grades of darkness and brightness of an object\'s appearance to make the object look solid.
Line Buffer
A line buffer is a memory buffer used to hold one line of video. If the horizontal resolution of the screen is 640 pixels and RGB is used as the color space, the line buffer would have to be 640 locations long by 3 bytes wide. This amounts to one location for each pixel and each color plane. Line buffers are typically used in filtering algorithms.
MIP Mapping
Multum in Parvum (Latin) means \'many in one\'. A method of increasing the quality of a texture map by applying different-resolution texture maps for different objects in the same image, depending on their size and depth. If a texture-mapped polygon is smaller than the texture image itself, the texture map will be undersampled during rasterization. As a result, the texture mapping will be noisy and \'sparkly\'. The purpose of MIP mapping is to remove this effect.
Occlusion
The effect of one object in 3-D space blocking another object from view.
Palletized Texture
Palletized Texture means compressed texture formats, such as 1-, 2-, 4-, and 8-bit instead of 24-bit; this allows more textures to be stored in less memory.
Perspective Correction
A particular way to do texture mapping; it is extremely important for creating a realistic image. It takes into account the effect of the Z value in a scene while mapping texels onto the surface of polygons. As a 3D object moves away from the viewer, the length and height of the object become compressed, making it appear shorter. Without perspective correction, objects will appear to shift and \'tear\' in an unrealistic way. True perspective correction is that the rate of change per pixel of texture is proportional to the depth. Since it requires a division per pixel, perspective correction is very computing intensive.
Phong Shading
Phong shading is a sophisticated smooth shading method, originated by Phong Bui-tuong. The Phong shading algorithm is best known for its ability to render precise, realistic specula highlights. During rendering, Phong shading achieves excellent realism by calculating the amount of light on the object at tiny points across the entire surface instead of at the vertices of the polygons. Each pixel representing the image is given its own color based on the lighting model applied at that point. Phong shading requires much more computation for the hardware than Gouraud shading.
Projection
The process of reducing three dimensions to two dimensions for display is called Projection. It is the mapping of the visible part of a three dimensional object onto a two dimension screen.
Rasterization
Translating an image into pixels.
Rendering
The process of creating life-like images on a screen using mathematical models and formulas to add shading, color, and lamination to a 2D or 3D wireframe.
Rendering Engine
"Rendering Engine" generically applies to the part of the graphics engine that draws 3D primitives, usually triangles or other simple polygons. In most implementations, the rendering engine is responsible for interpolation of edges and "filling in" the triangle.
Scissors Clip
Test pixel coordinates against clip rectangles and reject them if outside.
Set-up Engine
A set-up engine allows drivers to pass polygons to the rendering engine in the form of raw vertex information, subpixel polygon addresses. Whereas, most common designs force the host CPU to pre-process polygons for the rendering engine in terms of delta values for edges, color, and texture. Thus, a set-up engine moves processing from the host CPU to the graphics chip, reducing bus bandwidth requirements by 30% for small, randomly placed triangles and by proportionately more for larger polygons.
SDRAM
Synchronous DRAM is a type of DRAM to which reads or writes can be performed synchronously with the memory clock and at much higher speeds than with Fast-Page or EDO DRAM.
SGRAM
Synchronous Graphics Random Access memory (SGRAM) is a type of memory that is optimized for graphics use. SGRAM is capable of running at much higher speeds than fast page or EDO DRAM. SGRAM is able to execute a small number of frequently executed operations, such as buffer clears, specific to graphics applications independently of the controller.
Span
In raster graphics architecture a primitive is formed by scan conversion where each scan line intersects the primitive at two ends, P left and P right. A contiguous sequence of pixels on the scan line between P left and P right is called a Span. Each pixel within the span contains the z, R, G, and B data values.
Tessellation
Processing 3D graphics can be pipelined into three-stages: tessellation, geometry, and rendering. Tessellation is the process of subdividing a surface into smaller shapes. To describe object surface patterns, tessellation breaks down the surface of an object into manageable polygons. Triangles or quadrilaterals are two usually used polygons in drawing graphical objects because computer hardware can easy manipulate and calculate these two simple polygons.
An object divided into quads and subdivided into triangles for convenient calculation.
Texture Anti-aliasing
An interpolation technique used to remove texture distortion, staircasing or jagged edges, at the edges of an object.
Texture Filtering
Removing the undesirable distortion of a raster image, also called aliasing artifacts, such as sparkles and blockiness, through interpolation of stored texture images.
Texture Mapping
Texture mapping is based on a stored bitmap consisting of texture pixels, or texels. It consists of wrapping a texture image onto an object to create a realistic representation of the object in 3D space. The object is represented by a set of polygons, usually triangles. The advantage is complexity reduction and rendering speed, because only one texel read is required for each pixel being written to the frame buffer. The disadvantage is the blocky image that results when the object moves.
Transformation
Change of coordinates; a series of mathematical operations that act on output primitives and geometric attributes to convert them from modeling coordinates to device coordinates.
Tri-linear Filtering
Based on bilinear filtering, trilinear filtering takes the weighted average of two levels of bilinear filtering results to create a single telex. The resultant graphics image is smoother and less flashy.
Tri-linear MIP Mapping
A method of reducing aliasing artifacts within texture maps by applying a bilinear filter to four texels from the two nearest MIP maps and then interpolating between the two.
Z-buffer
A part of off-screen memory that holds the distance from the viewpoint for each pixel, the Z-value. When objects are rendered into a 2D frame buffer, the rendering engine must remove hidden surfaces.
Z-buffering
A process of removing hidden surfaces using the depth value stored in the Z-buffer. Before bringing in a new frame, the rendering engine clears the buffer, setting all Z-values to \'infinity\'. When rendering objects, the engine assigns a Z-value to each pixel: the closer the pixel to the viewer, the smaller the Z value. When a new pixel is rendered, its depth is compared with the stored depth in the Z-buffer. The new pixel is written into the frame buffer only if its depth value is less than the stored one.
Z-sorting
A process of removing hidden surfaces by sorting polygons in back-to-front order prior to rendering. Thus, when the polygons are rendered, the forward-most surfaces are rendered last. The rendering results are correct unless objects are close to or intersect each other. The advantage is not requiring memory for storing depth values. The disadvantage is the cost in more CPU cycles and limitations when objects penetrate each other.
———————————————————————————————————————
1998年最热门的话题莫过于3D,从年初的G100、Permedia2、6326、VOODOO、RIVA128到目前的i740、G200,如果说去年大多数3D处理芯片的性能还比较差,尤其是在运行Quake等3D效果极为强烈的游戏时,往往显得捉襟见肘、错误百出,但今年以来的3D图形处理芯片已经令人相当满意了,支持的3D效果高达数十种,各种3D指标也非常耀眼,这对于购机用户以及广大读者来说是好事,但大量出现在广告、文章中的这些3D特性术语却令我们的读者有雾里看花的感觉。笔者在此用一个版的篇幅详细介绍目前常用的3D特性术语,让你走出迷雾,把它看得清清楚楚。
一、3D API
API是Application Programming Interface应用程序接口的缩写,是许多程序的大集合。一个3D API能让编程人员所设计的3D软件只要调用其API内的程序,从而让API自动和硬件的驱动程序沟通,启动3D芯片内强大的3D图形处理功能,从而大幅度地提高了3D程序的设计效率。目前普遍应用的3D API有DirectX、OpenGL、Glide、Heidi。
•DirectX
微软公司专为PC游戏开发的API,与Windows 95 和Windows NT操作系统兼容性好,可绕过图形显示接口(GDI)直接进行支持该API的各种硬件的底层操作,大大提高了游戏的运行速度,而且目前基本上是免费使用的。由于要考虑与各方面的兼容性,DirectX用起来比较麻烦、在执行效率上也未见得最优。具体组成及功能详情可参看本报第33期(8月31日)“Microsoft DirectX 6.0演武传奇”一文。
•OpenGL (开放式图形接口)
由Silicon Graphics公司开发,能够在Windows 95、Windows NT、Macos、Beos、OS/2、以及Unix上应用的API。由于OpenGL起步较早,一直用于高档图形工作站,其3D图形功能很强,超过
DirectX,能最大限度地发挥3D芯片的巨大潜力。在Windows 98中已经支持Direct X和OpenGL。在OpenGL的1.2版中增加了对3DNow!标准的支持。
•Glide
这是3Dfx公司为VOODOO系列3D加速卡设计的专用3D API,它可以最大限度发挥VOODOO系列芯片的3D图形处理功能,由于不考虑兼容性,其工作效率远比OpenGL和Direct 3D高,所以Glide是各3D游戏开发商优先选用的3D API。不过,这样一来就使得许多精美的3D游戏在刚推出时,只支持3Dfx公司的VOODOO系列3D加速卡,而其它类型的3D加速卡则要等待其生产厂商提供该游戏的补丁程序。
•Heidi
Heidi是一个由Autodesk公司提出来的规格。目前,采用Heidi系统的应用程序包括3D Studio MAX动画制作程序、Autodesk公司为 AutoCAD R13开发的WHIP加速驱动程序。
二、3D特性
•Alpha Blending (α混合)
简单地说这是一种让3D物件产生透明感的技术。屏幕上显示的3D物件,每个像素中有红、绿、蓝三组数值。若3D环境中允许像素能拥有一组α值,我们就称它拥有一个α通道。α值的内容,是记载像素的透明度。这样一来使得每一个物件都可以拥有不同的透明程度。比如说,玻璃会拥有很高的透明度,而一块木头可能就没什么透明度可言。α混合这个功能,就是处理两个物件在萤幕画面上叠加的时候,还会将α值列入考虑,使其呈现接近真实物件的效果。
•Fog Effect (雾化效果)
雾化效果是3D的比较常见的特性,在游戏中见到的烟雾、爆炸火焰以及白云等效果都是雾化的结果。它的功能就是制造一块指定的区域笼罩在一股烟雾弥漫之中的效果,这样可以保证远景的真实性,而且也减小了3D图形的渲染工作量。图1是游戏《恐龙猎人》中的一个画面,其雾化效果非常不错。
•Shading(着色处理)
绝大多数的3D物体是由多边形(polygon)所构成的,它们都必须经过某些着色处理的手续,才不会以线结构(wire frame)的面目示人。着色处理分为Flat Shading平面着色、Gouraud Shading 高洛德着色
1.Flat Shading (平面着色):平面着色是最简单也是最快速的着色方法,每个多边形都会被指定一个单一且没有变化的颜色。这种方法虽然会产生出不真实的效果,不过它非常适用于快速成像及其它要求速度重于细致度的场合。
2.Gouraud Shading (高洛德着色): 这种着色的效果要好得多,它可对3D模型各顶点的颜色进行平滑、融合处理,将每个多边形上的每个点赋以一组色调值,同时将多边形着上较为顺滑的渐变色,使其外观具有更强烈的实时感和立体动感,不过其着色速度比平面着色慢得多。
•Mapping(贴图处理)
分为Texture Mapping材质贴图、Mip Mapping Mip贴图、Bump Mapping 凹凸贴图、Video Texture Mapping视频材质贴图。
1.Texture Mapping (材质贴图):是在物体着色方面最引人注意、也是最拟真的方法,同时也多为目前的游戏软件所采用。一张平面图像(可以是数字化图像、小图标或点阵位图)会被贴到多边形上。例如,在赛车游戏的开发上,可用这项技术来绘制轮胎胎面及车体着装。
2.Mip Mapping (Mip贴图):这项材质贴图的技术,是依据不同精度的要求,而使用不同版本的材质图样进行贴图。例如:当物体移近使用者时,程序会在物体表面贴上较精细、清晰度较高的材质图案,于是让物体呈现出更高层、更加真实的效果;而当物体远离使用者时,程序就会贴上较单纯、清晰度较低的材质图样,进而提升图形处理的整体效率。
3.Bump Mapping (凹凸贴图):这是一种在3D场景中模拟粗糙外表面的技术。将深度的变化保存到一张贴图中,然后再对3D模型进行标准的混合贴图处理,即可得到具有凹凸感的表面效果,如图2所示。
4.Video Texture Mapping ( 视频材质贴图):这是目前最好的材质贴图效果。具有此种功能的图形图像加速卡,采用高速的图像处理方式,将一段连续的图像(可能是即时运算或来自一个AVI或MPEC的档案)以材质的方法处理,然后贴到3D物件的表面上去。
•Texture Map Interpolation(材质影像过滤处理)
当材质被贴到屏幕所显示的一个3D模型上时,材质处理器必须决定哪个图素要贴在哪个像素的位置。由于材质是2D图片,而模型是3D物件,所以通常图素的范围与像素范围不会是恰好相同的。此时要解决这个像素的贴图问题,就得用插补处理的方式来解决。而这种处理的方式共分三种:“近邻取样”、“双线过滤”以及“三线过滤”。
1.Nearest Neighbor (近邻取样)
是一种较简单材质影像插补的处理方式。会使用包含像素最多部分的图素来贴图。换句话说就是哪一个图素占到最多的像素,就用那个图素来贴图。这种处理方式因为速度比较快,常被用于早期3D游戏开发,不过材质的品质较差。
2.Bilinear Interpolation (双线过滤)
这是一种较好的材质影像插补的处理方式,会先找出最接近像素的四个图素,然后在它们之间作差补效果,最后产生的结果才会被贴到像素的位置上,这样不会看到“马赛克”现象。这种处理方式较适用于有一定景深的静态影像,不过无法提供最佳品质,也不适用于移动中的物件。在图5中,右边的画面没有采用“双线过滤”,从而出现了比较严重的“马赛克”现象;而左边的画面由于采用了“双线过滤”,图像显得非常“柔和”。
3.Trilinear Interpolation (三线过滤):这是一种更复杂材质影像插补处理方式,会用到相当多的材质影像,而每张的大小恰好会是另一张的四分之一。例如有一张材质影像是512×512个图素,第二张就会是256×256个图素,第三张就会是128×128个图素等等,总之最小的一张是1×1。凭借这些多重解析度的材质影像,当遇到景深极大的场景时(如飞行模拟),就能提供高品质的贴图效果。一个“双线过滤”需要三次混合,而“三线过滤”就得作七次混合处理,所以每个像素就需要多用21/3倍以上的计算时间。还需要两倍大的存储器时钟带宽。但是“三线过滤”可以提供最高的贴图品质,会去除材质的“闪烁”效果。对于需要动态物体或景深很大的场景应用方面而言,只有“三线过滤”才能提供可接受的材质品质。在图6中,右边的画面由于没有采用“三线过滤”,竹帘部分产生了严重的“闪烁”现象;而左边的画面采用了“三线过滤”,竹帘细节部分非常清晰。
•Perspective Correction (透视角修正处理)
它是采用数学运算的方式,以确保贴在物件上的部分影像图,会向透视的消失方向贴出正确的收敛。在图3中,当图形画面向前倾斜时,左边的画面由于采用了“透视角修正”技术,画面上的直线保持真实的透视效果;而右边的画面没有采用“透视角修正”技术,因而画面上的直线出现了失真。
•Anti-aliasing (反锯齿处理)
简单地说主要是应用调色技术将图形边缘的“锯齿”缓和,边缘更平滑。反锯齿是相对来来说较复杂的技术,一直是高档加速卡的一个主要特征。目前的3D加速卡大多不支持反锯齿,但在下一代3D加速卡如RIVA TNT、G200中将支持这项技术。
•Z Buffer (Z 缓存)
Z-buffering是在为物件进行着色时,执行“隐藏面消除”工作的一项技术,所以隐藏物件背后的部分就不会被显示出来。
在3D环境中每个像素中会利用一组数据资料来定义像素在显示时的纵深度(即Z轴座标值)。Z Buffer所用的位数越高,则代表该显示卡所提供的物件纵深感也越精确。目前的3D加速卡一般都可支持16位的Z Buffer,新推出的一些高级的卡已经可支持到32位的Z Buffer。对一个含有很多物体连接的较复杂3D模型而言,能拥有较多的位数来表现深度感是相当重要的事情。
•Double Buffering (双重缓冲区处理)
绝大多数可支持OpenGl的3D加速卡都会提供两组图形画面信息。这两组图形画面信息通常被看着“前台缓存”和“后台缓存”。显示卡用“前台缓存”存放正在显示的这格画面,而同时下一格画面已经在“后台缓存”待命。然后显示卡会将两个缓存互换,“后台缓存”的画面会显示出来,且同时再于“前台缓存”中画好下一格待命,如此形成一种互补的工作方式不断地进行,以很快的速度对画面的改变做出反应。