Dredok
(Dredok)
February 20, 2015, 6:33pm
458
I’d hoping to get cleaner batch api and/or instanced component in 4.8, but am less certain about automatic batching. If you want to take a look now, look at UPaperSpriteComponent::SendRenderDynamicData_Concurrent. It builds a FSpriteDrawCallRecord and sends it to render thread. For multiple sprites that share a texture, material, and y plane, you can just keep appending Sprite->BakedRenderData to DrawCall.RenderVerts, but you’ll need to offset in XZ for each one obviously. At some point will probably change to actual vertex format (vec3 position, vec2 uv, color) so that sprites at different local y planes or colors can be batched as well.
You ought to be able to subclass UPaperSpriteComponent to have an array of UPaperSprite* pointers + local offsets and just override SendRenderDynamicData_Concurrent in order to batching going pretty quickly.
Cheers,
So if they are not in same y-plane, they can not be batched together?
is a pity because my characters are composed by several sprites, they move together and I need to put them in different y-planes to ensure right visualization!