Download

Best way to call C++ functions from different stages of render loop

Hi all,

I’d like to call functions at specific parts of the Unreal render loop (e.g. RenderPrepass, BeginOcclusionTests, ParticleSimulation etc.). I’ve done a bit of C++ coding but never really needed to access engine functions like this, so was hoping for some guidance on the best way to go about it. I’m hoping to just send calls back to my own class, which could then run it’s own logic (namely logging) at these specific points. Any help or direction would be great.

Have a look at RenderCore\Public\RendererInterface.h, which is the public renderer interface where you can find some (but not that many) hooks that you can use.

Thanks Ale_32, I’ve had time to take a look at RendererInterface.h today. It’s a little unclear from the file itself which functions are relevant, but some definitely look promising (e.g. BeginFrame, PostRenderAllViewports). My main issue is I’m still not sure of the best way to call my own code when these functions are triggered, should I be overriding virtual functions or similar? I’m sure a lot of it is coming from my lack of experience with C++ and the source code.

It’s strange Unreal is lacking access to these kinds of calls - I know Unity has functions like ‘OnPreCull’ or ‘OnPreRender’ that can be accessed easily, allowing you to run code at different points of the render loop.