Curious what the workflow is for optimizing sprites in a 3D scene. Obviously when it comes to 3D objects in a scene you have options like batch groups, lower amounts of materials, frustum culling etc…
What should I be doing for animated sprites that are in a 3D scene? I’m using sprites to simulate a crowd in stadium seating and am pasting the same sprites around a lot. It’s not using an insane amount of draw calls for a pretty good effect but was just curious if there is any optimization I should/could be doing since this is for low-end mobile devices
Let’s assume there are 3 frames for the animation and 300 crowd people.
You would have 100 instances of frame 1 as a plane with a material, 100 instances of frame 2 and 100 instances of frame 3.
Then you would swap them around to simulate sprite animation. ie move frame 2 instance positions to where frame 1 instances are, frame 3 to frame 2 and frame 1 to frame 2.
With hardware instancing you can have unique position, rotation and scale per instance just by filling the array buffer showed in the example.
There is also space for a 4th attribute without adding a new vertex buffer, but still you will need to write a custom shader to use that (e.g. for diffuse color). If you are determined to have more attributes, that’s doable with a custom vertex buffer.
Here is a related post about custom colors per instance using HW instancing: