Tie a Scene Capture 2D to player camera

The answer to this question https://answers.unrealengine.com/questions/120180/creating-a-mirror-using-scene-capture-2d-actor.html mentions a scene capture 2D tied to the players camera.

I want to capture the output from the camera and write it to a texture for use later on in the post processing pipeline. Using the method in the above answer do I end up rendering the scene twice or is it actually possible to capture the rendering output in this way before it is destroyed?

In case there is an alternative option I want access to the rendered scene in a post process material 2nd (and later) blend stage when it no longer seems to be available in the SceneTexture:PostProcessInput0.

Regards,

Phil

Hey PhilMaguire -

In the mirror example you reference above I am capturing the scene from the Scene Capture 2D camera every frame. You should be able to disable that feature and only have the scene capture actor render when moved and have that image saved to a Render Texture which can then be later on passed into your Post Process Material as needed.

Thank You

Eric Ketchum

Thanks Eric,

That sounds like a good optimisation. I will implement this solution today.

Are there any plans on the engine roadmap to allow access to the rendered scene throughout the post process blend stages, without having to re-render it using a scene capture 2D, as this sounds like quite an expensive thing to do?

Regards,

Phil

Hey PhilMaguire -

I am not sure directly if we have plans to address this, but you can setup a render path in code which would do the same things, but each would generate the same performance load with the code being maybe slightly more performant. I will let our engineers know that there is a desire for this functionality though.

Eric Ketchum

Hello Eric,

Having done some profiling of the SceneCapture2D, this approach is just too costly on the GPU (approx 2x as you might expect) for me to use.

What I would like is the contents of SceneTexture::PostProcessInput0 to be available and unchanging in later blend passes in my post process volume, maybe accessed via something like SceneTexture::PostProcessInputX (X>0).

I think what I will try next is to grab the contents of the render buffer and copy that into a render target from C++, rather than using a Scene Capture 2D.

Thanks for your help,

Phil

Hello Phil,

I’m wondering how can you access the render buffer in C++ code?
Thank you!