Hi Everyone! Time for a quick progress update on Scissor2D!
My initial focus has been to prototype ways to make a batched geometry renderer that will allow individual actor components to submit draw calls that can then later be layer sorted and batched together if they are using the same materials and textures. Ideally this would be done at a render command level inside the Unreal render loop, but I am having to work with the limitations of what I can do in a plugin. So for now my plan has been to have a centralised ScissorRendererActor that you place into the scene, other Actor Components can then send scissor draw commands to the ScissorRendererActor that then on its render call, does all the batching / layering magic.
The goal of this approach is to give the performance of using a Paper2DGroupedSpriteComponent while still maintaining the convenience of using individual actors with their own sets of components attached. Also because the ScissorRendererActor just accepts dynamic geometry to render each frame, all Scissor2D components such as sprites, terrain, tilemaps etc will be able to go through the same renderer and be batched and correctly layer sorted.
I have setup a quick benchmark test in Scissor2D, Paper2D and Unity(5.6) so we can track performance metrics as the plugin is developed. Currently the benchmark just spawns 5000 identical sprites randomly over the screen. Keep in mind fps measuring is non linear as you get to very low frame millisecond times, so it is much better to look at the ms per frame for comparison.
I am testing this on a i5-3570, 660gt at 1280x720
From this I can say initial results are looking good performance wise! But there are some downsides to this approach that I am yet to tackle / solve. Unreal does its editor selection logic via what has been rendered onto the screen, but as you are always clicking on geometry that has been rendered via the ScissorRendererActor, it will not select the original actor that represents the geometry in the scene. I am looking at ways to get around this at the moment in this thread (if anyone has any ideas!) Making a Batched Sprite Renderer - Selection Issues - Engine Source & GitHub - Unreal Engine Forums
Another issue is going to be mixing things rendered via the ScissorRenderer and other unreal mesh types. Batching has the potential to break scene draw order if a mesh comes between a number of sprites that can be batched together. This is only really a problem for 2D in 3D setups, but something to keep an eye on.
But this is all just one sprite! I hear you cry. Yes correct, the focus of the next bit of prototyping is the sprite import pipeline. Currently the sprite texture is just hard coded into a placeholder material. Once I get the import pipeline setup we can get on to testing atlas batching and layering correctly.
Thanks for reading! Keep the ideas / feedback coming! it is all very useful