蒙皮网格 GPU 顶点缓冲区的预期目标用法。
默认情况下,蒙皮网格渲染器顶点缓冲区的目标用法的 getTarget 为GraphicsBuffer.Target.Vertex。如果您想从计算着色器访问顶点缓冲区,则需要请求其他目标,例如 GraphicsBuffer.Target.Raw。
using UnityEngine;
public class ExampleScript : MonoBehaviour { void Start() { // Mark the vertex buffer as needing "Raw" // (ByteAddressBuffer, RWByteAddressBuffer in HLSL shaders) // access. We can then use GetVertexBuffer and // use it with compute shaders. GetComponent<SkinnedMeshRenderer>().vertexBufferTarget |= GraphicsBuffer.Target.Raw; } }