Plugin FPrimitiveSceneProxy Billboarder

Hi Unreal Engine C++ developpers,

I render billboards in a plugin, this works, but I encounter several problems along the way:

I got my FPrimitiveSceneProxy with PreRenderView and DrawDynamicElements.

  • My billboarding is full CPU (unlike Cascade who billboards in the vertex shader).
    I can get billboards oriented for N Views, and for 1 shadow per view (as each View contain a Shadow view matrix). BUT:

  • I don’t know how to know DrawDynamicElements is currently rendering in the Shadow pass ? (and that I should use my VertexFactory with position shadow view oriented)

  • I can’t find a way to billboard for X shadows in each View ? One and unique FMeshBatch seems to be rendered for each Shadow views during 1 shadow pass.

  • I could billboard asynchronously, launching tasks in PreRenderView, and waiting them just before DrawDynamicElements.
    But sometimes PreRenderView is called, but not DrawDynamicElements, this is problematic to unlock buffers and all…

  • Is there way in PreRenderView, to know for sure how many DrawDynamicElements will be called ?

  • Or Is there a kind-of PostRenderView ?

  • Or even better, A callback or override near the FMeshBatch or VertexFactory called just before the actual draw ? (still needs one of the 2 first point)

Or just should I hack the Unreal Engine core ?

Thank You.

You might want to just set up a Runnable thread to do your billboarding async, then in PreRenderView, you can make it request the data back and block and complete if it’s not done already.