How to optimize drawcall for 2d renderer

Now each 2d light generates a new drawcall. This is a huge performance waste.

Wondering what optimizations can be used on a 2d renderer.

SRP Batcher?GPU instancing?Dynamic batcher?

Do they work on 2d lights?

2 Likes

@rustum couldn’t lights with compatible parameters be batched? For instance, I have 50 sprite lights on screen with only color and matrix differences.

Hi @xiao-xxl & @Lo-renzo ! Thanks for the questions!

We’re always looking at improving performance of the 2D Renderer. It would be most helpful if you could tell us more about the result you are trying to achieve. Pictures and details are very useful too!

Here’s an example: some terrain that’s lit with quite a few lights that fade in/out over time.

In the Frame Debugger, this produces a light texture like so (left) but many DrawMesh calls that are nearly identical (right).

If these were normal sprites, not sprite lights, they would be batched. I know the 2D Renderer does all kinds of fancy stuff to batch light layers, but within a layer there’s still individual DrawMesh calls.

@rustum Any news on this?

2D lights (no shadows) are not batching together when making a simple “ring” of the same 2D light. All lights are on the same layer too (URP 12.1.4):

|