除官方文档所写内容外,还有三个注意点。 1.shader中要加上宏,防止编译出错 #if USE_INSTANCING half4 worldPos = ObjectToWorldPositionInstancing(In,float4(VPOut.Position.xyz,1)); #else half4 worldPos = ObjectToWorldPosition(float4(VPOut.Position.xyz,1)); #endif 2.然后effect里参考文档要加上宏 https://developers.weixin.qq.com/minigame/dev/guide/framework/render/resource/effect-material.html#%E9%85%8D%E7%BD%AE%E5%AE%8F%E5%AE%9A%E4%B9%89 [图片] 3.然后材质球里参考文档要加上宏 https://developers.weixin.qq.com/minigame/dev/game-engine/render/shading/material.html#RenderDefinations [图片] renderdoc截帧可看到成功调用GPUInstance [图片]
GPUInstance提示ObjectToWorldPositionInstancing方法不存在https://developers.weixin.qq.com/minigame/dev/guide/framework/render/optimize/instancing.html vertexERROR: 0:28: 'ObjectToWorldPositionInstancing' : no matching overloaded function found
2023-04-14