I am currently prototyping ways to make a batched sprite renderer. My current approach is to have a centralised BatchedRenderActor (with appropriate components) that takes commands from other Actors in the scene that need dynamic geometry batched and rendered. This is all working well except for Actor selection logic.
Currently if you click on any of the rendered geometry in the editor, it will select the main BatchedRenderActor (as expected it is drawing the geometry). But I would like a way to auto select the actor that submitted the render call to the BatchedRenderActor. I’ve been digging into the Selection logic of Unreal and it seems to use a special render pass that can be used to identify HitProxies for the pixels rendered. From this it seems a high level way to solve this would be to either:
- Render the individual Actors geometry only into the HitProxy render pass and make the BatchedRenderActor render as normal but non selectable.
- During the BatchedRenderActor render pass into the HitProxy map, actually somehow embed info for the individual Actors so when clicked it highlights the correct actor.
I’m not really sure what is the best way to approach this as 1) will potentially have editor performance issues as everything needs a render proxy just for doing selection logic that is then rendered by something else and 2) has issues with actors draw commands will be batched together before the BatchedRenderActor makes its real renderer commands, so this is going to cause issues defining HitProxies.
Any ideas or pointers on how to proceed would be greatly appreciated (even other ways to do the rendering entirely if it means I can still sort and batch the sprites, while still making them selectable)