I am working on a isometric pixel art graphics pipeline with lighting, and I am running into some issues. I’d like to incorporate custom height maps (to give the scene some “faked” depth for lighting).
This works well so far, but currently it involves me using a custom shader, that samples both the diffuse texture and the custom heightmap texture. Because this parameter could change multiple times within a Begin/End pair, I need to use SpriteSortMode.Immediate.
Visually, everything works. I am getting nice height maps with some good lighting effects. But using SpriteSortMode.Immediate is definitely hurting performance, and its becoming noticeable. A typical draw call draws around 1000 tiles.
Could anyone provide some guidance as to what the best practices are for using per-sprite parameters for shaders, while also taking advantage of batching? How would bigger games get around this issue?