material | 要使用的 Material。 |
bounds | 围绕要绘制的实例的包围体。 |
topology | 程序化几何体的拓扑。 |
camera | If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given Camera only. |
bufferWithArgs | 具有绘制参数的缓冲区。 |
argsOffset | 缓冲区中的字节偏移,绘制参数所在位置。 |
properties | 在绘制此网格之前应用于材质的其他材质属性。请参阅 MaterialPropertyBlock。 |
castShadows | 确定网格是否可以投射阴影。 |
receiveShadows | 确定网格是否可以接受阴影。 |
layer | 要使用的 Layer。 |
在 GPU 上绘制程序化的几何形状。
This function only works on platforms that support compute shaders.
DrawProceduralIndirect does a draw call on the GPU, without any vertex or index buffers.
The amount of geometry to draw is read from a ComputeBuffer. Typical use case is generating an arbitrary amount of data from a ComputeShader and then rendering that, without requiring a readback to the CPU.
这主要在 Shader Model 4.5 级别的硬件中有用,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。
带参数的缓冲区 bufferWithArgs
必须在给定的 argsOffset
偏移处具有四个整数:
每个实例的顶点数、实例数、起始顶点位置和起始实例位置。
这会映射到 Direct3D11 DrawInstancedIndirect 和其他图形 API 中的等效函数。在 OpenGL 4.2 之前的版本和支持间接绘制的所有 OpenGL ES 版本中,最后一个参数保留,因此必须是零。
CommandBuffers 中也有类似的功能,请参阅 CommandBuffer.DrawProceduralIndirect。
另请参阅:Graphics.DrawProcedural、ComputeBuffer.CopyCount、SystemInfo.supportsComputeShaders。
material | 要使用的 Material。 |
bounds | 围绕要绘制的实例的包围体。 |
topology | 程序化几何体的拓扑。 |
indexBuffer | 用于将顶点提交到 GPU 的索引缓冲区。 |
camera | If null (default), the mesh will be drawn in all cameras. Otherwise it will be rendered in the given Camera only. |
bufferWithArgs | 具有绘制参数的缓冲区。 |
argsOffset | 缓冲区中的字节偏移,绘制参数所在位置。 |
properties | 在绘制此网格之前应用于材质的其他材质属性。请参阅 MaterialPropertyBlock。 |
castShadows | 确定网格是否可以投射阴影。 |
receiveShadows | 确定网格是否可以接受阴影。 |
layer | 要使用的 Layer。 |
在 GPU 上绘制程序化的几何形状。
DrawProceduralIndirect 在 GPU 上执行绘制调用,没有顶点缓冲区。
要绘制的几何体数量可从 ComputeBuffer 中读取。典型的用例是从 ComputeShader 中生成任意数量的数据,然后渲染该数据,无需回读 CPU。
这主要在 Shader Model 4.5 级别的硬件中有用,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。
带参数的缓冲区 bufferWithArgs
必须在给定的 argsOffset
偏移处具有五个整数:
每个实例的索引数、实例数、起始索引位置、基顶点位置和起始实例位置。
这会映射到 Direct3D11 DrawIndexedInstancedIndirect 和其他图形 API 中的等效函数。在 OpenGL 4.2 之前的版本和支持间接绘制的所有 OpenGL ES 版本中,最后一个参数保留,因此必须是零。
CommandBuffers 中也有类似的功能,请参阅 CommandBuffer.DrawProceduralIndirect。
另请参阅:Graphics.DrawProcedural、ComputeBuffer.CopyCount、SystemInfo.supportsComputeShaders。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.