CPT205 W5

This is the note of CPT205 Week5. This week is mainly about Viewing and Projection.

  • Concepts of viewing and projections
  • Types and advantages/disadvantages of projection
  • 3D viewing co-ordinate parameters
  • Orthogonal projection
  • Frustum perspective projection
  • OpenGL functions
  • Sample code

Lecture

Classic viewing

  • Viewing requires three basic elements
    • One or more objects
    • A viewer with a projection surface 带有投影表面的视图
    • Projectors that go from the object(s) to the projection surface 从物体到投影表面的投影仪
  • Classical views are based on the relationship among these elements 经典的观点是基于这些元素之间的关系
    • The viewer picks up the object and orients the object in a way that it is to be seen. 观察者拿起对象,并以一种可以被看到的方式对对象进行定位。
  • Each object is constructed from flat principal faces 每个对象都是由平面主面构成的
    • Buildings, polyhedra, manufactured objects, etc. 建筑物、多面体、人造物体等。

Classic projection


Planar geometric projection 平面几何投影

  • Standard projections project onto a plane. 标准投影投影到一个平面上。
  • Projectors are lines that either converge at a centre of projection or are parallel. 投影线是在投影中心相交或平行的线。
  • Such projections preserve lines but not necessarily angles. 这样的投影保留了直线,但不一定保留了角度。
  • Non-planar projections are needed for applications such as map construction. 地图制作等应用需要非平面投影。

Taxonomy of planar geometric projection


Perspective vs parallel

  • Computer graphics treats all projections in the same way and implements them with a single pipeline. 计算机图形以相同的方式处理所有投影,并使用单个管道实现它们。
  • Classical viewing has developed different techniques for drawing each type of projection. 古典观影已经发展了不同的技术来绘制每种类型的投影。
  • The fundamental distinction is between parallel and perspective viewing even though mathematically parallel viewing is the limit of perspective viewing. 基本的区别是平行观和透视观之间的区别,尽管数学上的平行观是透视观的极限。

说个简单的自己的理解:perspective就是肉眼看到的比较近距离的透视,所以会产生远景看起来比较小的情况;而parallel则是远距离看起来的情况,所以就会像正视图之类的一样看不到阴影。


Perspective projection

  • Perspective projection generates a view of 3- dimensional scene by projecting points to the view plane along converging paths, causing the objects farther from the viewing position to be displayed smaller than the objects of the same size that are nearer to the viewing position. 透视投影通过沿着汇聚路径将点投影到视场平面上,使距离观看位置较远的物体比距离观看位置较近的相同大小的物体更小,从而生成三维场景的视图。
  • A scene generated using perspective projection appears more realistic since this is the way that human eyes and cameras form images. 使用透视投影生成的场景看起来更真实,因为这是人眼和相机形成图像的方式。

Perspective projection


Parallel projection

  • This method projects points on the object surface along parallel lines. 这种方法沿着平行线将点投射到物体表面上。
  • It is usually used in engineering and architecture drawings to represent an object with a set of views showing accurate dimensions. 它通常用于工程和建筑图纸,以一组显示精确尺寸的视图来代表一个物体。


Parallel projection


Multiview Orthographic projection

The projectors are orthogonal to projection surface. 投影仪正交于投影曲面。

  1. The projection plane is parallel to the principal face. 投影面与主面平行。
  2. Usually form front, top and side views. 通常形成正面,顶部和侧面视图。

Multiview orthographic projections
Advantages and disadvantages

  • Preserves both distances and angles 保持距离和角度
    • Shapes preserved 形状保存
    • Can be used for measurements 可用于测量
      • Building plans
      • Manuals
  • Cannot see what object really looks like because many surfaces are hidden from the view 无法看到物体的真实样子,因为许多表面被隐藏在视图中
    • Often the isometric view is added

Axonometric projections

Allow projection plane to move relative to the object.

Axonometric projections
所以要注意观察到底能看到几个角度,这是三种axonometric projections的区别
Advantages and disadvantages

  • Lines are scaled (foreshortened) but can find scaling factors 线是缩放的,但可以找到缩放因子
  • Lines preserved but angles are not 保留线,但不保留角度
    • Projection of a circle in a plane not parallel to the projection plane is an ellipse 圆在不平行于投影平面的平面上的投影是椭圆
  • Can see three principal faces of a box-like object 能看到一个盒状物体的三个主要面
  • Some optical illusions possible 可能存在一些视错觉
    • Parallel lines appear to diverge 平行线似乎分开了
  • Does not look real because far objects are scaled the same as near objects 看起来不真实,因为远的对象缩放与近的对象相同
  • Used in CAD applications 用于CAD应用

Oblique projection

投影仪与投影平面之间的任意关系。

Advantages and disadvantages

  • Can pick the angles to emphasise a particular face 可以选择角度来强调一个特定的脸
    • Architecture: plan oblique, elevation oblique
  • Angles in faces parallel to the projection plane are preserved while we can still see “around” side. 与投影平面平行的面的角度被保留,而我们仍然可以看到“周围”的一面。
  • In the physical world, we cannot create oblique projections with a simple camera; possible with bellows camera or special lens (architectural) 在物理世界中,我们不能用一个简单的相机创建斜投影;可配波纹管相机或特殊镜头

Perspective projection

投影仪会聚于投影中心。


Vanishing points

  • Parallel lines (not parallel to the projection plane) on the object converge at a single point in the projection (the vanishing point).物体上的平行线(不平行于投影平面)收敛于投影中的一个点(灭点)。
  • Drawing simple perspectives by hand uses the vanishing point(s). 手动绘制简单的透视图使用消失点。

Vanishing points


Three-point perspective

  • No principal face parallel to the projection plane 没有平行于投影平面的主面
  • Three vanishing points for the cube 立方体的三个消失点

Three-point perspective


Two-point perspective

  • One principal direction parallel to the projection plane 有一个平行于投影平面的主面
  • Two vanishing points for the cube 立方体两个消失点

Two-point perspective


One-point perspective

  • One principal face parallel to the projection plane 有一个平行于投影平面的主面
  • One vanishing point for the cube 立方体一个消失点

One-point perspective


Advantages and disadvantages

  • Objects further from the viewer are projected smaller than the same sized objects closer to the viewer (diminution) 距离观察者更远的物体被投射得比距离观察者更近的相同大小的物体更小(缩小)
  • Equal distances along a line are not projected into equal distances (non-uniform foreshortening). 沿直线等距离的投影不等于等距离(非均匀透视缩短)。
  • Angles preserved only in planes parallel to the projection plane. 仅在与投影平面平行的平面上保留的角。
  • More difficult to construct by hand than parallel projections (but not more difficult by computer). 手工构造比平行投影更困难(但用计算机构造并不困难)。

Computer viewing and projection

There are three aspects of viewing process, all of which are implemented in the pipeline:

  • Positioning the camera: Setting the model-view matrix
  • Selecting a lens: Setting the projection matrix
  • Clipping: setting the view volume

3D viewing co-ordinate parameters





Orthogonal projection 正交投影

  • Orthogonal (or paralell) projection is a transformation of object descriptions to a view plane along lines parallel to the view-plane normal vector N. 正交(或平行)投影是将对象描述沿平行于视图平面法向量N的线转换到视图平面的一种方法。
  • It is often used to produce the front, side and top views of an object. 它通常用于生成对象的正面、侧面和顶部视图。
  • Engineering and architectural drawings commonly employ these orthographic projections since the lengths and angles are accurately depicted and can be measured from the drawings. 它通常用于生成对象的正面、侧面和顶部视图。



从一个正交投影体到参考系内的系统标准化立方体的标准化变换


Frustum perspective projection

  • By adding near and far clipping planes that are parallel to the viewing plane, parts of the infinite perspective view volume are chopped off to form a truncated pyramid or frustum. These clipping planes can be optional for some systems. 通过添加与观察平面平行的近和远剪切平面,无限透视视图体的部分被切掉,形成一个截短的金字塔或截锥。对于某些系统来说,这些裁剪平面是可选的。
  • The near and far clipping planes can be used simply to enclose objects to be displayed. The near clipping plane can be used to take out large objects close to the viewing plane, which could be projected into unrecognisable shapes in the clipping window. Likewise, the far clipping plane can cut out objects that may be projected to small blots. 近和远剪切面可以用来简单地包围要显示的对象。近剪切面可以用来剔除靠近观察面的大物体,这些物体可以在剪切窗口中投影成无法识别的形状。同样,远剪切平面可以切割出物体,这些物体可能被投影到小的斑点上。
  • Some systems restrict the placement of the viewing plane relative to the near and far planes, and other systems allow it to be placed anywhere except at the position of the viewing origin (view point, viewing position, eye position or camera position).
  • If the viewing plane is behind the projection reference point, objects are inverted on the view plane. 一些系统限制观察平面相对于近平面和远平面的位置,而其他系统允许它放置在任何位置,除了观察原点的位置(视点,观察位置,眼睛位置或相机位置)。
  • If the viewing plane is behind the objects, the objects are simply enlarged as they are projected away. 如果观察平面在投影参考点之后,物体在观察平面上被倒置。
  • When the projection reference point is very far away from the view plane, a perspective projection approaches to a parallel projection. 当投影参考点离视盘非常远时,透视投影接近平行投影。


simple perspective projection

  • Centre of projection at the origin
  • Projection plane z = d, d < 0



OpenGL functions

gluLookAt(eye_position, look_at, look_up)
Specify three-dimensional viewing parameters.
gluLookAt

glOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far)
Specify parameters for a clipping window and the near and far clipping planes for an orthogonal projection. 为裁剪窗口和正交投影的近、远裁剪平面指定参数。
glFrustum

gluPerspective(GLfloat fov, GLfloat aspect, GLfloat near, GLfloat far)
Specify field-of-view angle (fov which is a matrix) in the y- direction, the aspect ratio of near and far planes; It is less often used than glFrustum(). 指定y方向的视场角度(fov为矩阵),即近平面和远平面的纵横比;它的使用频率低于glFrustum()。
gluPerspective


References

  1. XJTLU CPT205 week5 slides
作者

Felix Chen

发布于

2021-10-12

更新于

2021-10-14

许可协议

评论