Version: 2020.3

Graphics.DrawMeshInstancedProcedural

切换到手册
public static void DrawMeshInstancedProcedural (Mesh mesh, int submeshIndex, Material material, Bounds bounds, int count, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows, int layer, Camera camera, Rendering.LightProbeUsage lightProbeUsage, LightProbeProxyVolume lightProbeProxyVolume);

参数

mesh 要绘制的 Mesh
submeshIndex 要绘制网格的哪个子集。这只适用于由若干种材质构成的网格。
material 要使用的 Material
bounds 围绕要绘制的实例的包围体。
count 要绘制的实例数。
properties 要应用的其他材质属性。请参阅 MaterialPropertyBlock
castShadows Determines whether the Meshes should cast shadows.
receiveShadows Determines whether the Meshes should receive shadows.
layer 要使用的 Layer
camera If null (default), the mesh will be drawn in all cameras. Otherwise it will be drawn in the given Camera only.
lightProbeUsage 实例的 LightProbeUsage

描述

Draws the same mesh multiple times using GPU instancing. This is similar to Graphics.DrawMeshInstancedIndirect, except that when the instance count is known from script, it can be supplied directly using this method, rather than via a ComputeBuffer.

要使用光照探针渲染实例,请通过 MaterialPropertyBlock 提供光照探针数据,并使用 LightProbeUsage.CustomProvided 指定 /lightProbeUsage/。有关详细信息,请参阅 LightProbes.CalculateInterpolatedLightAndOcclusionProbes