DIRECTX 12 5.9 裁剪

不在视锥体的近平面远平面上下左右平面之间的都要删除掉:

Sutherland-Hodgeman 裁剪算法,基本上相当于找到平面和多边形边之间的交点,然后对顶点排序以形成新的剪裁多边形。

在齐次空间中, 做除法之前, 4D points (x, y, z, w)

透视投影之后, points

  • −1 ≤ x/w ≤ 1
  • −1 ≤ y/w ≤ 1
  • 0 ≤ z/w ≤ 1

在视锥体中的点应该满足:

  • −w ≤ x ≤ w
  • −w ≤ y ≤ w
  • 0 ≤ z ≤ w

也就是说,这些点由简单的4D平面限定:

  • Left: w = −x
  • Right: w = x
  • Bottom: w = −y
  • Top: w = y
  • Near: z = 0
  • Far: z = w
Author: 木尘痕
Link: https://muchenhen.com/2020/03/20/directx-12-5-9-%E8%A3%81%E5%89%AA/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.