This is a continuation of a semi old conversation here Spritesheet example / support for instanced meshes? - Questions & Answers - HTML5 Game Devs Forum
I’m finally going back to this and created a playground to show a simple example of what I am trying to do with it. For one example: In my game, In order to not create 2 million advanced dynamic textures, I am creating instances of the numbers 0-9. Right now I am not using a sprite sheet, so I am loading 9 512x512 textures into GPU, with 9 master meshes to create instances from (yuck) - I would like to use a texture atlas instead, to get rid of 8 draw calls. SpriteManager does not work for me due to it not being a real mesh/parenting/animation issues.
I’m still having trouble wrapping my head around buffers/attributes, but specifically how I can use buffers/attributes to send the data for a particular sprite cell, for the fragment shader (and how to track which instance corresponds to which sprite cell). I’ve been trying to understand the code in the sprite manager class, however it’s confusing since it does so much. In my case I just want to take 1 master number mesh, and slice it up for each of the numbers, so that I can use createInstance on 1 master mesh instead of 9
Any chance you can help me fill in the blanks in the playground below @Deltakosh ?
(I’m hoping it’s much simpler than the sprite manager class since it is managing multiple sprites and drawing them all at once, but I’m not sure how much of the code is necessary to get to a working version).