Computer Graphics Hidden Algorithm, Computer Graphics Big Homework Course Design Experiment Report Hidden Algorithm.doc

Hiding Algorithm for Experiment Report of Computer Graphics University Homework Course Design

Anhui Institute of Architecture and Technology

computer graphics homework

Big Job Title: Blanking Algorithm Demonstration

College (Department) Name:

profession:

class:

Name:

student ID:

instructor:

2011 ~ 2012 first semester

Computer Graphics - Blanking Algorithms

aim of design:

By detecting visible faces, hidden lines and hidden faces are eliminated to display photorealistic graphics on 2D planes.

Eliminating hidden lines and hidden surfaces is a difficult but crucial problem in computer graphics. The concealment algorithm is to decide which lines, surfaces or objects are visible and which are not visible relative to an observer at a given position in space. This chapter mainly shows and discusses some of the most commonly used hidden line and hidden surface concealment methods and techniques.

Design thinking:

Projection transformation loses depth information, which often leads to ambiguity of graphics. To eliminate ambiguity, it is necessary to eliminate invisible lines or surfaces that are occluded when drawing. It is customarily called eliminating hidden lines and hidden surfaces, abbreviated as blanking. The projected image obtained by blanking is called the real image of the object.

Determine the algorithm class

So far, many effective concealment algorithms have been proposed. These algorithms can be classified according to the coordinate system or space in which the algorithm is implemented. Generally, they can be divided into two categories: object space algorithms and image space algorithms.

This paper adopts image-space methods, which detect the visibility point by point of each pixel position on the projection plane or display screen. This algorithm is relatively crude. And the picture obtained by the image space algorithm is often unsatisfactory after being enlarged. However, this algorithm is computationally efficient, because the coherence of the picture can be fully utilized in the raster scanning process.

Determining the collective implementation algorithm

remove hidden lines

Requirements for styling

In the wireframe display model, it is required to have surface information in the modeling system, preferably body information.

Coordinate transformation

Transform the viewpoint to the positive infinity of the Z axis, and the line of sight direction becomes the negative direction of the Z axis.

the most basic operation

Determine the occlusion relationship of the face line. Repeat the intersection operation between the line and the line

face blanking

Classification of surface concealment algorithms (blanking algorithms in image space, concealment algorithms in object space)

Common methods for improving the efficiency of concealment algorithms (using coherence, converting perspective projections to parallel projections, bounding box techniques, backface culling, space segmentation techniques, hierarchical representation of objects)

本文是利用Z-Buffer算法的思想运用几何知识实现的,称为Z-Buffer算法的改进算法。

设计过程:

Z-Buffer算法的思想:先将Z缓冲器中个单元的初始值置为最小值。当要改变某个像素的颜色值时,首先检查当前多边形的深度值是否大于该像素原来的深度值(保存在该像素所对应的Z缓冲器的单元中),如果大于,说明当前多边形更靠近观察点,用它的颜色替换像素原来的颜色;否则说明在当前像素处,当前多边形被前面所绘制的多边形遮挡了,是不可见的,像素的颜色值不改变。

改进法:通过记录投影与当前扫描线相交的多边形。

求点的平行投影和透视投影坐标值

用三维点坐标直接从当前点画线到某点

三维坐标下直接将当前点移动到某点

表面三个顶点调用求该表面的法矢

求观察方向矢量与表面法矢的数量积

画出立体上的平面并绘出消隐立体图

设计总结:

选择不同的消隐算法消隐问题有不同的算法,有些算法要求速度快,有些要求图形的真实度高。例如,快速消隐算法可用于实时模拟如飞行模拟等;具有高度真实感图形的消隐算法可用于计算机动画等领域,所生成的图形一般具有连续色调,并能产生阴影、透明、表面纹理及反射、折射等视觉效果。不过这类算法比较慢。产生一幅图可能需要几分钟甚至几小时。所以,在进行消隐算法的设计时,应在计算速度和图形细节之间进行权衡,任何一种算法都不能兼顾两者。

消隐算法的实现空间消隐算法可以在物体空间或图像空间中实现。

物体空间算法是在定义物体的坐标系中实现的,而图像空间算法是在对象显示的屏幕坐标系中实现的。

物体空间算法以尽可能高的精度完成几何计算,所以可以把图像放大许多倍而不致损害其准确性,但是图像空间算法只能以与显示屏的分辨率相适应的精度来完成计算,所以其图像的放大效果较差。

这两类算法的性能特性也是不同的。物体空间算法所需的计算时间随场量中物体的个数而增加,而图像空间的计算时间则随图像中可见部分的复杂程度而增加。

设计平台:

Computer(Windows xp),VC++

附件:

void CMyView::Project(float X, float Y, float Z)// 此函数求点的平行投影和透视投影坐标值

{

XObs = -X * Aux1 + Y * Aux3;

YObs = -X * Aux5 - Y * Aux6 + Z * Aux4;

// 求透视投影坐标值

ZObs = -X * Aux7 - Y

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325673742&siteId=291194637