GAMES101-04空间变换 Cont.


一、3D transformations

//在数学上,如果一个矩阵的逆等于它的转置,则叫做正交矩阵


万向锁

Rodrigues’ Rotation Formula
罗德里格斯旋转公式

定义了一个旋转轴和一个旋转角度(默认原点起点)

找到四元数并做矩阵变换

二、Viewing (观测) transformation

1.View(视图)/ Camera transformation

. Think about how to take a photo

  • Find a good place and arrange people ( m odel transformation)
    • Find a good “angle” to put the camera ( v iew transformation)
    • Cheese! ( p rojection transformation)
      模型-识别-投影变换(MVP变换)

首先定义相机的放置位置,朝向,角度(顶朝向)

原本相机可以在任意位置,但为了简化,可以将相机放在标准位置(0,0)。

先平移,再旋转
Translate e to origin
在这里插入图片描述
Rotate g to -Z, t to Y,(g x t) To x
反过来写,再求逆
Consider its inverse rotation: × to (g x t),Y to t,Z to -g

Summary

  • Transform objects together with the camera
  • Until camera’s at the origin, up at Y, look at -Z
    ModelView Transformation模型+视图变换

2.Projection (投影) transformation

eg

  • Orthographic (正交) projection
    不会带来近大远小的视觉误差
    (道理我都懂,但是鸽子为什么这莫大?)
    we want to map a cuboid [1,r]x [b, t]x [f,n] to the "canonical (正则、规范、标准)"cube [-1,1]3
    正则立方体

    先将x,y,z方向移动到以原点中心
    再将立方体正则化
    Translate (center to origin) first,then scale (length/width/height to 2)


Caveat

  • Looking at / along -Z is making near and far not intuitive (n > f)

  • FYl: that’s why OpenGL (a Graphics APl) uses left hand coords.

  • Perspective(透视)projection
    Most common in Computer Graphics, art, visual system
    Further objects are smaller
    Parallel lines not parallel; converge to single point

透视投影到别的平面上后,平行线会不平行。

Recall:
property of homogeneous coordinates

  • (x,y,z,1),(kx, ky,kz,k != O), (xz, yz,z2,z !=0)all represent the same point (x, y, z) in 3D
  • e.g.(1,0,0,1) and (2,0,0,2) both represent (1,0, 0)
    透视投影的平面大小会改变,而正交投影是一样的。

规定:
近平面永远不变。
在平面内向里收缩,远平面不变位置。
Frustum to Cuboid
相似三角形

ln order to find a transformation

  • Find the relationship between transformed points (x’,y’,z’)and the original points (x, y,z)
    In homogeneous coordinates

    继续推导得:

    Observation: the third row is responsible for z’
  • Any point on the near plane will not change
  • Any point’s z on the far plane will not change

Solve for A and B
An+B = 2→4A =n+ f
Af + B = f2
B=—n f
Finally, every entry in Mpersp->ortho is known!What’s next?

  • Do orthographic projection(Mortho) to finish-Mpersp = Mortho Mpersp→ortho
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值