- Home /
SpriteSheet/Mesh Hybrid to reduce overdraw on iOS?
Is this a mad idea?
We are currently sitting on a lot of sprite content, and need to convert these for use on iOS. The sprites will very likely overlap, causing a lot of overdraw. The sprites themselves don't have any half-transparency. They're pure cutouts.
Would it be overkill to write a system to triangulate the sprite sheet into more of a "mesh sheet"? Would the gains in rendering each sprite opaque be worth it?
We have an idea of how to do it, technically. Just wondering if it's worth the performance? Anyone know or do I have to do a mockup for some tests?
Answer by dannyskim · Nov 07, 2011 at 10:37 PM
I'm not sure if you have seen, but there is a SpriteManager script available on the UnifyCommunity sounds like it does exactly what you want.
"To address this, my SpriteManager class builds a single mesh containing the sprite "quads" to be displayed, and then "manually" transforms the vertices of these quads at runtime to create the appearance of multiple, independently moving objects - all in a single draw call!"
http://www.unifycommunity.com/wiki/index.php?title=SpriteManager
You may also want to look at the the improved version, SpriteManager2 which has editor extensions and is much easier to use, both authored by anbsoft.com
Thanks, but this still requires an alpha transparency shader. We have a lot of overlapping alpha sprites, which (I'm thinking/hoping/wondering) could be displayed more efficiently on iOS if they were all opaque cutouts.
You are right about the opaque cutouts. $$anonymous$$y latest project which uses a lot of full screen alpha blending and a lot of alpha blended objects has reduced performance on even the iphone 4 dramatically due to overdraw.
I have since then moved to opaque cutouts, which of course is a pain, but upped my performance dramatically.
Answer by goodhustle · Feb 23, 2013 at 06:38 AM
I've seen this done in 2DToolkit. IIRC it allows you to specify a cutout size, and it will cut out alpha blocks from the fully transparent areas of your sprites.