学期结束,放一下CS5182 Computer Graphics 的期末revision 笔记~
Rasterization-based rendering pipeline
1. Representations of 3D Object model
2. Transformation (25points)
What is Homogeneous coordinates齐次坐标? the purpose.
With homogeneous coordinates, we can build a unified approach to combine the transformations so that the final coordinate positions are obtained directly from the initial coordinate by the product of the transformation matrices. 有了齐次坐标,我们可以建立一个统一的方法来组合变换,使得最终坐标位置直接从初始坐标通过变换矩阵的乘积获得
we add a one more dimension, the purpose of introduced homogeneous coordinate system is a tier to unify the different transformation in the form of a matrix modification, in the form of a machine modification, we want to cope with the translation. 我们多加一个维度,引入齐次坐标系的目的是为了统一不同的变换,以矩阵的形式修改,以机器修改的形式,我们要配合平移
2D transformations
3D transformation
3D homogeneous coordinate is represented in (x,y,z,1)
Inverse transformation 逆变换
Matrix multiplication is not commutative! 矩阵乘法不是可交换的
The order of transformations: cannot change the order.
3. Projection
perspective projection, parallel projection, and perspective transformation
透视投影、平行投影、透视变换
parallel projection 平行投影
perspective projection 透视投影
Parallel projection does not give us depth information. 平行投影无深度信息
perspective gives the impression of 3D depth and distance in an image. 透视给人3D深度和距离
perspective transformation 透视变换
4. Hidden/Back Surface Removal
Image space algorithms
Determine what color is used to paint at each pixel. They do their work as the objects are being converted to pixels in the frame buffer. The test is carried out in 2D space. 确定用于绘制每个像素的颜色,二维的
5. Clipping
1. The Cohen-Sutherland Line-Clipping Algorithm
2. The Sutherland-Hodgman Polygon-Clipping Algorithm
6. Rasterization
Rasterization
The process of taking a primitive and figuring out which pixels it covers.
获取原语并确定其覆盖哪些像素的过程
The interior of the triangle is the set of points that is inside all three half-spaces defined by these lines. 三角形的内部是由这些线定义的所有三个半空间内的点集
问题: Please suggest a method to determine the covered pixels of a triangle primitive during the rasterization stage involved in the rendering pipeline. 建议一种方法,在渲染管道中涉及的光栅化阶段确定三角形原语的覆盖像素
假设三角形的边可以看作是将 2D 平面(图像的平面)一分为二的线,创建一个边函数,看点在直线的哪一边。函数返回一个正数,当它位于在线的左侧,当它位于该线的右侧时为负数,当该点正好在线上时为零。如果对于这一点,我们发现边缘函数为所有三个边缘返回一个正数,则该像素包含在三角形中(或可能位于其边缘之一)
Aliasing锯齿
The Aliasing Problems in CG
In 2D drawing, a straight line may look like staircases and a character may look like discretized. This kind of phenomenon is called aliasing.
The aliasing effect is the appearance of jagged edges or “jaggies” in a rasterized image (an image rendered using pixels). 锯齿效应是在栅格化图像(使用像素渲染的图像)中锯齿边缘或“锯齿”的外观, 从视觉上来看,锯齿表现为分辨率过低的图像中边的阶梯形状
Anti-Aliasing (5 methods) 反锯齿
1. Supersampling 超采样
- increases the number of samples. Supersampling works by rendering the image at a higher resolution than the display resolution and then downsampling it to the display resolution. 在较高分辨率下进行采样,并在屏幕的较低分辨率或分辨率下显示图像
- Easy to implement the method in hardware. 易于硬件上实现
- amount of memory and processing time需要大量的内存和处理时间
- It does not eliminate aliasing; it only reduces it. why? in that the computer often has no clue where objects/edges/etc. are - it’s just taking a big image and making it smaller因为计算机通常不知道物体/边缘/等在哪里-它只是把一个大图像变小
2. Accumulation buffer 累积缓冲
- addresses the memory cost of the supersampling method解决了超级采样方法的内存成本问题
- The idea of anti-aliasing using the accumulation buffer is that the scene gets drawn multiple times with slight perturbations (called jittering), so that each pixel is a local average of the images that intersect it. 场景在轻微扰动(称为抖动)的情况下被多次绘制,因此每个像素是与其相交的图像的局部平均值
3. Stochastic sampling 随机抽样
- works by breaking up the regularity in the sampling. 打破规律性
- In stochastic sampling, every point in the signal has a non-zero probability of being sampled (unlike regular sampling where certain sections will never be sampled). 信号中的每个点都有被采样的非零概率(不同于常规采样,在常规采样中某些部分永远不会被采样)
4. Catmull’s algorithm
It calculates exactly how much a polygon covers a pixel, i.e., its color contribution to the pixel精确计算多边形覆盖像素的程度,即多边形对像素的颜色贡献.
Computationally very expensive due to polygon clipping and sorting polygon fragments by depth. 由于多边形裁剪和按深度排序多边形片段,计算非常昂贵
3. Clip each polygon against each pixel to form polygon fragments针对每个像素裁剪每个多边形以形成多边形片段
4. Determine visible fragments. 确定可见碎片
5. Find fragment areas. 寻找碎片区域
6. Multiply by fragment colors乘以片段颜色
7. Sum for final pixel color. 最终像素颜色的总和
5. The A-buffer method
- uses subpixel sampling to make summing areas simple.
此方法使用子像素采样使求和区域简单 - Processing per pixel depends only on number of visible fragments. 每个像素的处理只取决于可见片段的数量
- Still basically a supersampling algorithm.
- The A-buffer method is a descendant of the Z-buffer.
7. Shading
Illumination model
Light sources: Ambient/point/area/spotlight
12. Ambient light : uniform intensity from all directions, causing objects to be uniformly illuminated from any viewing position从各个方向均匀的强度,使物体从任何观察位置均匀地被照亮
13. point light : It emits directional light rays. 定向光线
Normally, light rays from a distant light source (e.g., sun light) may be considered as parallel and those from a close light source (e.g., table lamp) as divergent来自远处光源(例如太阳光)的光线可视为平行光,而来自近处光源(例如台灯)的光线可视为发散光
14. Spotlight (searchlight) 聚光灯 : projects a powerful beam of light of approximately parallel rays in a particular direction在一个特定的方向上投射出一束强大的近似平行的光线
15. Area light 区域光源 : occupies a finite, one- or two-dimensional area of space. It can cast soft shadows because an object can partially block their light. 占据一个有限的,一维或二维的空间。它可以投射柔和的阴影,因为一个物体可以部分阻挡他们的光线
Phong illumination model 照明模型 lighting model
determines the color of a surface point by simulating some light attributes通过模拟一些光的属性来确定一个表面点的颜色
The Phong illumination model consists of three parts.
- Ambient reflection 环境反射
- diffuse reflection 漫反射
- specular reflection 镜面反射
Phong Illumination Model
You should know the which kind of the required information for computing this and calculating the three kinds of reflection. 你应该知道计算这三种反射分别需要哪些信息
Shading method
should know basic idea and differences
shading method (surface rendering)
uses the color calculation from an illumination model to determine the pixel colors for all projected positions in a scene. 使用来自照明模型的颜色计算来确定场景中所有投影位置的像素颜色
1. Flat shading
For each polygon, we only compute the intensity value once. The whole polygon will be shaded with the same intensity value.对于每个多边形,仅计算强度值一次。整个多边形将用相同的阴影强度值。
fast and simple.
problem:
only produce very coarse reflection. 粗糙的反射
Intensity discontinuity between adjacent polygons. 强度不连续
2. Smooth shading
need to have per-vertex normals 每个顶点的法线
Gouraud shading
Interpolate color across triangles 插颜色
calculates per vertex (Vertex shader) 计算每个顶点(顶点着色器)
Fast, supported by most of the graphics accelerator cards快速,支持的大多数图形加速器卡
Phong shading
Interpolate normals across triangles 插值法线
calculates per fragment (fragment shader) 计算每个片段(片段着色器)
More accurate, but slower than Gouraud shading. 更准确
Ray Tracing and Radiosity
you should know the process and the advantage and the disadvantage, basic concept.
Three Types of Rendering
1. Rasterization-based rendering
Start from geometry
The processs:
- input object models
- world coordinate transformation
- perspective transformation
- Back-face removal
- clipping
- rasterization
- shading
- output image
extremely fast.
hard to compute accurate shadows, reflections and refractions. 没有阴影,反射和折射
cannot handle the scattering between objects. 没有散射
2. Ray tracing光线追踪
generates an image by tracing the flow of rays in a scene
试着反向追踪进入你眼睛的光线,并沿着这个轨迹找到光源
Calculate the color of a pixel.
consider direct specular and direct diffuse reflections as well as indirect specular reflection. 直接镜面, 间接的镜面反射, 直接漫反射
It considers light refraction and shadowing. 光折射和阴影
slow.
not consider indirect diffuse reflections. 没有间接漫反射
How to calculate the color of a pixel
从一条光线的所有相交物体计算出的颜色值由衰减因子(取决于表面反射率)加权,加起来产生一个单一的颜色值,成为像素的颜色
Acceleration Ray Tracing
Since ray-tracing spends a lot of time on detecting ray-object intersections, reducing the number of intersection tests can significantly reduce the computation time. 由于光线追踪在检测光线与物体相交上花费了大量时间,因此减少相交测试的次数可以显着减少计算时间
3. Radiosity放射线
It is computed in object-space.
The radiosity method is aimed at modeling diffuse reflection (both direct and indirect) among the surfaces in the scene. 漫反射(直接和间接)
Note that the computed radiosities are view-independent 视图无关
cannot handle specular reflection, which is view-dependent. 无法处理镜面反射
because it computes the energy transfer between surfaces and does not depend on the viewer’s position. 独立于视图的方法,因为它计算表面之间的能量传递,而不依赖于观察者的位置
Real-time rendering
for video game, reduce delay.
complete the rendering process within a given time, called the frame time (the time between two consecutive image frames) 帧时间内完成渲染
Fast visible object determination快速可见物体检测
To reduce rendering time, we may reduce the number of triangles to represent an object.
If an object is far away from the viewer, its details may not be clearly visible to the viewer.
Progressive rending technique: (multiple levels of detail) 多级细节
1. Discrete LoD
Pre-compute a few models at different resolutions, i.e., different levels of detail (LoDs), for each object. 预先计算不同分辨率的几个模型
Efficient.
Visual artifacts when switching models. 切换模型时的视觉伪影
2. Progressive mesh
Edge collapse边折叠 (The resolution of an object model can be reduced)
Vertex split顶点分裂 (The resolution of the model can be gradually increased)
is very efficient but may not be so effective for large models, because constructed in a view-independent way独立于视图的方式构建
when in high (resp. low) resolution, the whole model is in high (resp. low) resolution. 在高(低)分辨率时,整个模型是在高(低)分辨率
3. Selective refinement 选择性细化
optimize the number of triangles优化三角形的个数
if we can selectively refine the model resolution of a local region that we are interested at while keeping the rest at low resolution选择性地完善我们感兴趣的局部区域的模型分辨率,同时将其余部分保持在低分辨率
The difficulty with selective refinement is that there is a strong dependency between neighboring regions of triangles when we perform edge collapses or vertex splits选择性细化的难点在于,当我们进行边折叠或顶点分裂时,三角形的相邻区域之间存在很强的依赖性
visual quality and rendering cost
Ways to estimate the visual quality and rendering cost 估计视觉质量和渲染成本的方法
Visual Quality Estimation
The visual quality is usually measured based on:
The model’s level of detail (or number of primitives) used for rendering; 细节级别
The distance of the object from the viewer; 物体与观察者的距离
The projected size of the object on the screen; 对象在屏幕上的投影大小
The moving speed of the object; 物体的移动速度
The angular distance of the object from the viewer’s line of sight. 物体与观察者视线的角距离
Rendering Cost Estimation
select the appropriate level of detail and rendering method for each object efficiently, so that the maximum visual quality of the output image will be achieved without exceeding the allowable rendering time. 将在不超过允许的渲染时间的情况下实现输出图像的最大视觉质量
Shadows
1. Hard shadows 硬阴影
Contain only umbra regions. 仅包含本影区域
The use of point light sources causes the shadows to have sharp boundaries – resulting in hard shadows使用点光源会导致阴影具有清晰的边界
2. Soft shadows 柔和阴影
Contain umbra regions and penumbra regions. 本影区域和半影区域
The use of area light sources adds soft boundaries to shadows. These soft boundary regions are the penumbra regions. 区域光源的使用为阴影增加了柔和的边界。
Shadow volume methods 阴影体积方法
Determine if a point is in shadow: 确定点是否在阴影中
Shadow map methods 阴影映射方法
GPU and Animation
GPU vs. CPU
GPU stands for Graphics Processing Unit图形处理器
Lots of calculations and parallelism大量的计算和并行性
Simple control, multiple stages多个阶段
Latency-tolerant
Efficient computation:
Data-level parallelism数据级并行 and task-level parallelism任务级并行
Efficient communication
GPU architecture
- Traditional hardware graphics pipeline传统硬件图形流水线
- Advanced hardware graphics pipeline 高级硬件图形流水线
Programmable vertex processer, rasterizer, programmable fragment processors (which processor performs which tasks?) 可编程顶点处理器、光栅化器、可编程片段处理器(哪个处理器执行哪些任务?)
Computer Animation
know the basic concept is fine - Key frame 关键帧
- Procedure 程序
- Motion capture 动作捕捉