Reducing Overdraw via Shader?

Yet Another 2D game question :stuck_out_tongue:

So I whipped up my own sprite atlas-er and that appears to be working fine, but I noticed I was incurring a huge render hit, only after adding some textured planes as a backdrop. The performance drop is appalling (60fps → 20~40fps varying).

So my question is, is there a shader I can use that will render a renderer in only the ā€œfree spaceā€ between objects? I’m going for that classic 2D parallax look, and I need the quick performance.

Thanks for any help/advice :slight_smile:

Well if you need to lower overdraw using a tighter fitting mesh on things that are static or not animated (don’t change shape). However, if your losing a huge amount of performance from only a few textures it is doubtful the reason is overdraw. You’d have to be rendering a substantial number of textures for that to be a problem in a 2D game. Atlases lower your draw calls if you do them right (put all your static textures into them so several objects can be drawn at the same time).

I use 2Dtoolkit and it automates pretty much all that for you which is really nice.

The shaders in my sig are the fastest for 2D I’ve used.

Thanks for the replies!

Yeah, I’m already using an atlas (512px square, 15 x 15 textures @ 16px square each, 1px padding between all). I whipped up this script for the batching (mb that’s the problem?) The thing is, I’m making a tile-based platform game and need a ton of little textures for each block, so I have all the blocks mapped on the same atlas.

The reason I jumped to the overdraw conclusion is because the game runs SIGNIFICANTLY faster at lower resolutions.

@hippocoder I appreciate the suggestion, but the current budget is nil :frowning:

Related quetion: Is there a way I could tell all of the objects behind an object (like ā€˜sunbeams’ planes) to render darker/lighter without resorting to alpha?

~Le bump.~