How to completely disable all cameras?

We would like to only render through SceneCapture2D. We want to disable all cameras so there is no other rendering overhead. This might seem weird but the purpose is to capture screen shots via SceneCapture2D. The player screen can stay completely blank and we don’t care. Hope is that this will save significant rendering time.

I tried deactivating ACameraActor but that keeps camea alive anyway. So I tried setting PlayerController::SetViewTarget(nullptr) but then it finds another camera to activate. I basically want absolutely no camera to be active in the scene.

Is this possible?

1 Like

You can set bDisableWorldRendering on your ViewportClient object to false - it disables regular render path completely. ViewportClient can be extracted from ULocalPlayer:

if (ULocalPlayer* ClientPlayer = ...get player somewhere...)
{
    // Update player viewport state 
    if (UGameViewportClient* ViewportClient = ClientPlayer->ViewportClient)
    {
        ViewportClient->bDisableWorldRendering = !ShouldViewportRenderWorld();
    }
}
2 Likes

I tried this out. Unfortunately bDisableWorldRendering also disables rendering for SceneCapture2D. My goal is to disable rendering for CameraComponent while keeping rendering for SceneCapture2D alive. In other words, there is no rendering on main screen but we continue to render on SceneCapture2D so we can capture images.

One other thing I tried out was to do fad in camera to black. This leaves SceneCapture2D untouched but unfortunately there is no impact on FPS. This probably indicates that fad in is post processing effect and engine continue to do power lifting even when screen is blank.

My other option is to obstruct camera with some object so main screen turns black. Hope is that this will save resources used in rendering. But there has to be better way!!

Have you ever found the way to resolve this? I’m in exactly same situation as you. Right now I just rotate the camera backwards (thus making the view empty), but that may break if camera behavior is changed, but I don’t have any other ideas.

I found a workaround to this, you can use c4tnt suggestion and then call CaptureScene on the CaptureSceneComponent every frame and that works.

1 Like

I met the same problem. Have you solved it?

I created a small plugin that exposes the function you guys mentioned to blueprints to make it easier. Thanks!

3 Likes

Is the nullRHI unreal execution flag too harsh for your purpose?