如何将 2x2x2 的 NDC 的 MVP 矩阵转换为 2x2x1 立方体(金属)的 NDC 的 MVP 矩阵?

How to convert a MVP matrix of a NDC of 2x2x2 to a MVP matrix of a NDC of 2x2x1 cube (Metal)?

如何将中心为 0 (openGL) 的 2x2x2 立方体 NDC 的 MVP 矩阵转换为中心为 (0, 0, 0.5)(金属)的 2x2x1 立方体 NDC 的 MVP 矩阵?

这个 link 很好地解释了如何将矩阵从 OpenGL 转换为 Metal。

For Metal with its specific NDC, we could either derive the matrix in a similar fashion or use the easy way: transform OpenGL’s NDC to Metal’s NDC. This is done by doing a post multiplication which first scales the 2x2x2 cube to 2x2x1 and then shifts it by 0.5 to have the correct center: