Metal中的一些概念

坐标

1. Normalized device coordinate system

Vertex functions must provide position data in clip-space coordinates, which are 3D points specified using a four-dimensional homogenous vector (x,y,z,w). The rasterization stage takes the output position and divides the x,y, and z coordinates by w to generate a 3D point in normalized device coordinates. Normalized device coordinates are independent of viewport size.

顶点函数(Vertex functions)必须提供clip-space coordinates中的位置数据,这些数据是使用四维齐次向量four-dimensional homogenous vector (x,y,z,w)指定的3D点。光栅化阶段(rasterization stage)获取输出位置,并将x,y和z坐标除以w,以在**归一化设备坐标(Normalized device coordinates)**中生成3D点。 规范化的设备坐标与视口大小无关。

Figure 2 Normalized device coordinate system

Normalized device coordinates use a left-handed coordinate system and map to positions in the viewport. Primitives are clipped to a box in this coordinate system and then rasterized. The lower-left corner of the clipping box is at an (x,y) coordinate of (-1.0,-1.0) and the upper-right corner is at (1.0,1.0). Positive-z values point away from the camera (into the screen.) The visible portion of the z coordinate is between 0.0 (the near clipping plane) and 1.0 (the far clipping plane).
在这里插入图片描述

规范化的设备坐标使用左手坐标系,并将其映射到视口中的位置。 在图元坐标系中将图元裁剪到一个框,然后进行栅格化。

例子
在这里插入图片描述

2. texture coordinates

纹理坐标映射:将纹理图像上的位置映射到几何表面上的浮点位置。

For 2D textures, normalized texture coordinates are values from 0.0 to 1.0 in both x and y directions. A value of (0.0, 0.0) specifies the texel at the first byte of the texture data (the top-left corner of the image). A value of (1.0, 1.0) specifies the texel at the last byte of the texture data (the bottom-right corner of the image).

在这里插入图片描述

参考资料

【1】Using a Render Pipeline to Render Primitives. https://developer.apple.com/documentation/metal/using_a_render_pipeline_to_render_primitives?language=objc

【2】Creating and Sampling Textures. https://developer.apple.com/documentation/metal/creating_and_sampling_textures?language=objc

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 《Metal编程指南和参考(文).pdf》是一本关于Metal编程的指南和参考书籍。Metal编程是苹果公司开发的一种基于GPU的编程语言和框架,用于在iOS设备和Mac设备上进行高性能图形渲染和并行计算。 这本书的内容主要包括Metal编程的基础知识、核心概念、语法和语义等方面的内容。它从介绍Metal的应用领域和特点开始,然后深入讲解Metal编程的各个方面,包括渲染管线、着色器程序、纹理和缓冲等基本概念,以及如何使用Metal框架进行图形渲染和计算任务。 这本书还提供了大量的代码示例和实践案例,帮助读者更好地理解和应用Metal编程。通过这些示例,读者可以学习如何创建Metal应用程序,如何优化性能,以及如何处理不同类型的图形渲染和计算任务。 此外,书还介绍了Metal的最新特性和更新,以保持读者对Metal编程的了解与时俱进。同时,书还包含了常见问题解答和编程技巧,帮助读者解决实际问题。 总的来说,《Metal编程指南和参考(文).pdf》是一本介绍Metal编程语言和框架的权威资料。无论是初学者还是有一定Metal编程经验的开发者,都可以从获得实用的知识和技巧,提升自己在Metal编程领域的能力。 ### 回答2: 《metal编程指南和参考(文).pdf》是一本关于metal编程的指南和参考书籍。这本书详细介绍了metal编程的基础知识、核心概念和高级技术。作者通过系统化的方式,从入门到深入讲解了如何使用metal进行编程。 首先,这本书介绍了metal编程的背景和概述,帮助读者了解metal编程的历史和应用领域。然后,它详细介绍了metal编程的基本语法和语义,包括变量、函数、控制流等。通过这些基础知识,读者可以快速掌握metal的基本用法。 接着,书深入介绍了metal编程的高级特性和技术,如shader编程、图形渲染和并行计算等。这些内容对于想要在游戏开发、图形设计和科学计算等领域运用metal编程的人来说尤为重要。 此外,这本书还提供了大量的示例代码和实战项目,帮助读者通过实践来巩固和应用所学知识。这些项目涵盖了各个领域,包括3D游戏开发、图像处理和数据可视化等。 总之,《metal编程指南和参考(文).pdf》是一本全面而深入的metal编程教程。它适合初学者入门,也为有一定经验的开发者提供了宝贵的参考资料。无论是想要从零开始学习metal编程,还是提升metal技能的开发者,都可以从这本书获得实际的帮助和指导。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值