本页内容

Shader QML Type

用于定义后处理效果所用着色器代码的容器组件。更多...

Import Statement: import QtQuick3D
Inherits:

QtObject

属性

详细说明

着色器(Shader)类型用于填充Effect 中渲染pass 的shaders 列表。

着色器是一段代码,它会在渲染管线中的特定stage 阶段直接在图形硬件上执行。

另请参阅 Effect 。

属性文档

shader : url

指定着色器源文件的名称。有关如何编写着色器代码的详细信息,请参阅Effect 文档。

警告:着色器 代码片段被视为可信内容。建议应用程序开发人员在允许加载不属于应用程序本身的用户提供内容之前,仔细考虑其潜在影响。

stage : enumeration

指定渲染管线中执行着色器代码的阶段。默认值为Shader.Fragment

常量说明
Shader.Vertex该着色器为顶点着色器。此代码针对输入几何体的每个顶点执行一次,可用于在几何体进行光栅化(扫描转换)之前对其进行修改。对于特效而言,输入几何体始终是一个四边形(四个顶点分别代表渲染目标的四个角)。
Shader.Fragment该着色器是片段着色器。顶点处理完成后,修改后的几何体将转换为片段(光栅化)。 随后,针对每个片段执行片段着色器,为其分配一种颜色。片段与像素是相关的概念,但片段附带了额外的信息。此外,由于某些抗锯齿策略的影响,输出中的每个像素可能对应多个片段。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.