Sprite Alpha Render Draw Priority

Hey TD Devs & Community -

I am experiencing an alpha rendering issue with Sprites drawing over each other.

I made an example .tox I will attach here.

There is two cameras rendering the same scene, the only difference is one is shifted slighty to the left vs the right. It seems when the camera shifts over a particular axis (like negative to positive) the alpha rendering breaks.

I do not understand why. I have done a lot of trial and error. I hope this issue is my ineptitude and not a bug or limitation.

Any input from a wiser user or dev would be greatly appreciated!

Thanks!

sprite_alpha_order.tox (11.0 KB)

Hey @Mallin

Thanks for the report.

I can see the issue and this is logged for a developer to look into it and get back to you.

Best,
Michel

1 Like

Check out this article to understand how transparency works:

The key is the draw order needs to be farthest to closest. Moving the camera is changing which one is closest vs which one is farthest, but the draw order stays the same, which is why you see it flip.

Hey @malcolm,

I will read through this section, Thanks.

I have used draw priorities and alpha blends successfully before.

I feel like what is different this time is that I am using sprites, and instancing.

I am unsure how to apply draw priorities per-instance, also, how to update that when the camera moves into a new area that changes that order?

Reading the wiki now… but if sprites vs mesh is the issue - or instancing vs replicate - then I need to change my methods not the blend modes?

Thanks!

EDIT

Turns out reading is amazing, and you were absolutely right. Thank you Malcolm. For anyone who ends up looking for a similar answer, here is an updated .tox with the solution shown.

Press the button to flip/flop the draw order!

sprite_alpha_order_SOLVED.tox (12.2 KB)