10 · Instancing 实例化 · 在完整渲染管线中的位置
CPU / Draw数据准备 · Draw Call
→
Vertex InputVAO · VBO · Attribute
→
Vertex Shader逐顶点处理
→
Primitive Assembly组装 point / line / triangle
→
Geometry Shader可选 · 按图元处理
→
Rasterization图元 → fragments
→
Fragment Shader颜色 / 深度 / 采样
→
Per-SampleDepth · Stencil · Blending
→
Framebuffer颜色 / 深度附件

一份 Mesh + 一批实例数据 + 一次 Instanced Draw

Mesh Attribute 按 vertex 前进;offset / color / model matrix 等实例属性按 instance 前进。glVertexAttribDivisor 决定实例属性多久换一次,glDraw*Instanced 让 CPU 一次提交很多实例。

Mesh VBOposition / normal / uvInstance VBOmodel matrix · divisor=1Vertex Shader同一 Mesh不同 instance dataMany Instances
重点位置:CPU / Draw → Vertex Input → Vertex Shader