个人体会
如何学会一个变换?我觉得需要关注变换前后图像的区别,物体位置、大小变了没有?坐标系位置变了没有?
由于这篇文章介绍了一系列的变换,所以要关注前一个变换的输入,因为它是后一个变换的输出。
一个变换可以分解为多个更简单的变换。对一个向量左乘上一个矩阵,相当于对其执行了某种操作。
The Camera Transformation:实际上这个变换是调整相机朝向,使其与 u v w uvw uvw 坐标系对齐。
The Orthographic Projection Transformation:将 orthographic view volume 映射到 canonical view volume。
The Viewport Transformation:将 [ − 1 , 1 ] 2 [-1,1]^2 [−1,1]2 映射到 [ − 0.5 , n x + 0.5 ] × [ − 0.5 , n y + 0.5 ] [-0.5, n_x+0.5]\times[-0.5, n_y+0.5] [−0.5,nx+0.5]×[−0.5,ny+0.5]
Projective Transformations:用 4 维的仿射变换表示 3 维的线性变换,从而避免不能除以 z 的困扰。
Viewing
原文1:A second important use of geometric transformations is in moving objects between their 3D locations and their positions in a 2D view of the 3D world. This 3D to 2D mapping is called a viewing transformation, and it plays an important role in object-order rendering.
翻译1:几何变换的第二个重要用处是在它们的 3 维位置和他们的在 3 维世界的 2 维视图位置中移动物体。这个 3 维到 2 维的映射称之为视图变换,它在对象-顺序渲染过程中起了很重要的作用。
重点1: 3 D → 2 D : v i e w t r a n s f o r m a t i o n \mathbf{3D} \rightarrow \mathbf{2D}:\quad \mathbf{view} \quad \mathbf{transformation} 3D→2D:viewtransformation
原文2:By itself, the ability to project points from the world to the image is only good for producing wireframe renderings—renderings in which only the edges of objects are drawn, and closer surfaces do not occlude more distant surfaces (Figure 8.1). Just as a ray tracer needs to find the closest surface intersection along each viewing ray, an object-order renderer displaying solid-looking objects has to work out which of the (possibly many) surfaces drawn at any given point on the screen is closest and display only that one. In this chapter, we assume we are drawing a model consisting only of 3D line segments that are specified by the (x, y, z) coordinates of their two endpoints. Later chapters will discuss the machinery needed to produce renderings of solid surfaces.
翻译2:就其本身而言,将点从世界投影到图像的能力仅适用于生成线框渲染——在渲染中仅绘制对象的边缘,并且更近的表面不会遮挡更远的表面(图 8.1)。 就像光线追踪器需要沿着每条视线找到最近的表面交叉点一样,显示实体对象的对象顺序渲染器必须计算出在屏幕上任何给定点绘制的(可能许多)表面中的哪个最接近,并且 只显示那个。 在本章中,我们假设我们正在绘制一个仅由 3D 线段组成的模型,这些线段由它们的两个端点的 (x, y, z) 坐标指定。 后面的章节将讨论生成实体表面渲染所需的机制。
重点 2 :This chapter focus on wireframe renderings instead of solid surface rendering.

8.1 Viewing Transformations
原文 3 :The viewing transformation has the job of mapping 3D locations, represented as (x, y, z) coordinates in the canonical coordinate system, to coordinates in the image, expressed in units of pixels. It is a complicated beast that depends on many different things, including the camera position and orientation, the type of projection, the field of view, and the resolution of the image. As with all complicated transformations, it is best approached by breaking it up into a product of several simpler transformations. Most graphics systems do this by using a sequence of three transformations:
- A camera transformation or eye transformation, which is a rigid body transformation that places the camera at the origin in a convenient orientation. It depends only on the position and orientation, or pose, of the camera.
- A projection transformation, which projects points from camera space so that all visible points fall in the range −1 to 1 in x and y. It depends only on the type of projection desired.
- A viewport transformation or windowing transformation, which maps this unit image rectangle to the desired rectangle in pixel coordinates. It depends only on the size and position of the output image.
翻译 3 :视图变换的任务是将以在典范坐标系中(x,y,z)表示的 3 维坐标,映射到在图像中的坐标系,以像素作单位表示。这是一个复杂的东西,它取决于许多不同的东西,包括相机的位置和朝向,投影的类型,视野和图像的分辨率。对于所有复杂的转换,最好的方法是将其分解为几个更简单的转换的乘积。大多数图形系统通过使用三个转换序列来实现这一点:
- 一个相机变换或眼睛变换,这是一个刚体变换将相机以一个方便的方向放在原点。它只取决于相机的位置和方向,或位姿。
- 投影变换,从相机空间投射点,使所有可见点都落在x 和 y 的 −1 到 1 范围内。它只取决于所需的投影类型。
- 视口转换或窗口转换,它将这个单元图像矩形映射到像素坐标中所需的矩形。它只取决于输出图像的大小和位置。
为了便于描述过程的各个阶段(图8.2),我们对这些转换的输入和输出坐标系进行了命名。

原文 4 :The camera transformation converts points in canonical coordinates (or world space) to camera coordinates or places them in camera space. The projection transformation moves points from camera space to the canonical view volume. Finally, the viewport transformation maps the canonical view volume to screen space.
Each of these transformations is individually quite simple. We’ll discuss them in detail for the orthographic case beginning with the viewport transformation and then cover the changes required to support perspective projection.
8.1.1 The Viewport Transformation
The word “canonical” crops up again-it means something arbitrarily chosen for convenience.
For instance, the unit circle could be called the “canonical circle”.
翻译:“规范”这个词又出现了——它指的是为了方便而随意选择的东西。
例如,单位圆可以被称为“规范圆”。
原文 5 :

我们从一个问题开始,这个问题的解决方案将在任何视图条件下重复使用。我们假设我们想要看到的几何是在规范视图体里。我们希望以一个正交相机沿着 -z 轴观察。规范视图体是包含了所有某种 3 维点的立方体。如图8.3所示,这些 3 维点的笛卡尔坐标都在 -1与+1之间,即
( x , y , z ) ∈ [ − 1 , 1 ] 3 (x,y,z)\in[-1,1]^3 (x,y,z)∈[−1,1]3
重点来了!!!!
我们将 x = − 1 x=-1 x=−1 投影到屏幕的左侧, x = + 1 x=+1 x=+1 投影到屏幕的右侧, y = − 1 y=-1 y=−1 投影到屏幕的底端, y = + 1 y=+1 y=+1 投影到屏幕的顶端。
回忆来自第三章的针对像素坐标的传统:



每个像素“拥有”一个在整数坐标的单位正方形;图像边界与像素中心有半个单位的 overshoot;最小的像素中心坐标是(0,0)。如果我们画的图像有 n x × n y n_x\times n_y nx×ny像素,我们需要将正方形 [ − 1 , 1 ] [-1,1] [−1,1] 映射到 [ − 0.5 , n x − 0.5 ] × [ − 0.5 , n y − 0.5 ] [-0.5,n_x-0.5] \times [-0.5,n_y-0.5] [−0.5,nx−0.5]×[−0.5,ny−0.5]
目前,我们假设所有需要画的线段是完全在规范视图体内。过后,我们会放松假设当我们讨论 clipping 的时候。

注意上图,说了是要将
[ − 1 , 1 ] 2 [-1,1]^2 [−1,1]2
映射到
[ − 0.5 , n x − 0.5 ] × [ − 0.5 , n y − 0.5 ] [-0.5,n_x-0.5]\times [-0.5,n_y-0.5] [−0.5,nx−0.5]×[−0.5,ny−0.5]
这个结果可以用等式 (8.1)来验证,当 x c a n o n i c a l = − 1 o r 1 x_{canonical}=-1\quad or\quad 1 xcanonical=−1or1时,结果符合。

8.1.2 The Orthographic Projection Transformation




注意,下图中的式(8.3)在下面会介绍!!!
下图中提到 orthographic transform 是将
o r t h o g r a p h i c v i e w v o l u m e orthographic\quad view \quad volume orthographicviewvolume
映射到 c a n o n i c a l v i e w v o l u m e canonical \quad view \quad volume canonicalviewvolume
而,canonical view volume 在上图 8.3 中有介绍。


注意,上面所说的 equation(7.7)如下:




8.1.3 The Camera Transformation
实际上这个变换是调整相机朝向,使其与 u v w uvw uvw 坐标系对齐。
先阅读博主这两篇 单/二向量构造正交向量基底 ,坐标系变换有利于理解。



下图中说明了,要将坐标系 x y z − xyz- xyz−
转换到 u v w − uvw- uvw−坐标系。

上面构造 w , u , v \mathbf{w},\mathbf{u},\mathbf{v} w,u,v 的方法来自博文。
下面变换矩阵来自坐标系变换。


8.2 Projective Transformations
透视(perspective)的一个关键性质是:针对眼镜在原点,视线沿着负z轴看地情况,一个物体的大小在屏幕上与 1 / z 1/z 1/z等比例放缩。即
y s = d z y y_s = \frac{d}{z}y ys=zdy
图 8.8 很好地展示出了这个性质

其中, y y y 是空间中三维点沿着 y y y 轴的距离, y s y_s y

本文深入探讨了将3D对象映射到2D屏幕的过程,包括视图变换、正交投影和相机定位。视图变换通过刚体变换将相机置于合适位置,投影变换将3D点投影到2D视图体积内,而视口变换则将标准化图像矩形映射到实际像素坐标。此外,文章还介绍了透视投影,用于创建深度感,以及透视变换的线性有理函数特性。

最低0.47元/天 解锁文章
3169

被折叠的 条评论
为什么被折叠?



