问题描述
在金属中,在着色器内部(输入和输出)使用什么坐标系?当我们渲染到纹理时是一样的吗?用z缓冲区也可以吗?是否有任何不一致之处?最后,metal,opengl和directX有什么区别?
In metal what coordinate system to use inside shader (in and out)? and when we render to texture is it the same? with the z buffer also? Are there any inconsistencies? finally what are the difference between metal, opengl and directX ?
推荐答案
金属坐标系
金属定义了几个标准坐标系以表示转换后的图形数据渲染流程的不同阶段.
Metal Coordinate Systems
Metal defines several standard coordinate systems to represent transformed graphics data atdifferent stages along the rendering pipeline.
1)NDC(标准化设备坐标):开发人员可以使用此坐标来构造其几何形状,并通过模型和视图矩阵在顶点着色器中转换几何形状.
NDC 中的点(-1,-1)位于左下角(Y向上)..
1) NDC (Normalized Device Coordinate): this coordinates is used by developers to construct their geometries and transform the geometries in vertex shader via model and view matrices.
Point(-1, -1) in NDC is located at the the bottom left corner (Y up)..
2)帧缓冲坐标(视口坐标):当我们写入附件或从附件中读取内容或在附件之间复制/分割时,我们使用帧缓冲坐标来指定位置. 来源(0、0)位于左上角(Y向下).
2) Framebuffer Coordinate (Viewport coordinate): when we write into attachment or read from attachment or copy/blit between attachments, we use framebuffer coordiante to specify the location. The origin(0, 0) is located at the top-left corner (Y down).
3)纹理坐标:当我们将纹理上载到内存中或从纹理中采样时,我们使用纹理坐标. 来源(0、0)位于左上角(Y向下).
3) Texture Coordinate: when we upload texture into memory or sample from texture, we use texture coordinate. The origin(0, 0) is located at the top-left corner (Y down).
NDC: + Y向上.点(-1,-1)在左下角.
帧缓冲坐标:+ Y向下.原点(0,0)在左上角.
纹理坐标:+ Y向下. Origin(0,0)在左上角.
NDC: +Y is up. Point(-1, -1) is at the bottom left corner.
Framebuffer coordinate: +Y is down. Origin(0, 0) is at the top left corner.
Texture coordinate: +Y is down. Origin(0, 0) is at the top left corner.
NDC: + Y向上.点(-1,-1)在左下角.
帧缓冲坐标:+ Y向上.原点(0,0)在左下角.
纹理坐标:+ Y向上. Origin(0,0)在左下角.
NDC: +Y is up. Point(-1, -1) is at the bottom left corner.
Framebuffer coordinate: +Y is up. Origin(0, 0) is at the bottom left corner.
Texture coordinate: +Y is up. Origin(0, 0) is at the bottom left corner.
这篇关于金属中使用的坐标系是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!