Version: 2023.2
LanguageEnglish
  • C#

RayTracingGeometryInstanceConfig.vertexAttributes

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public VertexAttributeDescriptor[] vertexAttributes;

Description

An array of vertex attributes that define the vertex format of vertexBuffer.

The Position attribute is mandatory for building an acceleration structure. You can access other vertex attributes in shader code using helper functions from UnityRayTracingMeshUtils.cginc header.

// Defining a vertex format that contains the position, the normal and texture coordinates attributes.
VertexAttributeDescriptor[] vertexDescs = new VertexAttributeDescriptor[3];
vertexDescs[0] = new VertexAttributeDescriptor(VertexAttribute.Position, VertexAttributeFormat.Float32, 3, 0);
vertexDescs[1] = new VertexAttributeDescriptor(VertexAttribute.Normal, VertexAttributeFormat.Float32, 3, 0);
vertexDescs[2] = new VertexAttributeDescriptor(VertexAttribute.TexCoord0, VertexAttributeFormat.Float32, 2, 0);

Unity supports the following Position attribute data formats for building acceleration structures:

The Position attribute must be part of vertex buffer stream 0.

See Also: VertexAttributeDescriptor.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961