Hardware Instancing Script

Work in progress on this little script. The idea is to use hardware instancing without code. All you have to do is;

  • Create an entity and call it “whatever”
  • Add this script to the “whatever” entity
  • Throw in some objects and parent them to the “whatever” entity

And that’s it. You can disable all the objects while in editor so you can still work if it slows down the editor.

Script can be found here
ConvertToInstances.js

I’m still doing tests to it. But let me know how it works for you. :+1:

3 Likes

you could fallback to dynamic batching if device does not support instancing
http://playcanvas.github.io/#graphics/batching-dynamic.html

or provide it as an option … the advantage is that it can batch together meshes that have different geometry but same material)