• Godot Help3D
  • How to make a 3D Camera broadcast to a Viewport?

I have this idea for a game where the monitor is split into four viewports, letting you see in four directions at once. It's quite possible that it's going to be unplayable, but I have thought about it for so long and really want to try it!

I guess I should use HBoxContainer and VBoxContainer to manage it, and a ViewportContainer should contain the Viewport which should contain the Camera. So far so good.

But when I run it, I just get a grey screen.

Does anyone know what I may be doing wrong?

    kasper-hviid guess I should use HBoxContainer and VBoxContainer to manage it, and a ViewportContainer should contain the Viewport which should contain the Camera. So far so good.

    Don't forget scenes for the cameras to render.

    A camera will render it's surrounding scene to the viewport that is it's most immediate parent in the hierarchy. If you want multiple different cameras and viewports all rendering the same scene then you likely don't want those cameras and viewports in your H/VBox or grid container hierarchy. I.e. you won't be using a Viewport container.

    You might instead have texture rects or color rects in there instead of the viewport containers and you will assign by script each viewports result to each rect respectively.

      Megalomaniak

      Thanks, tried a textureRect and my structure now looks like this:

      • KinematicBody (player)
        • TextureRect (I set the texture to the Viewport in the Inspector)
          • Viewport
            • Camera

      And it actually show the camera feed when I play! Only problem is, when I move the KinematicBody, the Camera is no longer attached to it. So I think I need to somehow move the screen display stuff (TextureRect, Viewport) out of the player hierachy. New exciting problems!

      a year later

      Curious what happened with your experiment.

      I've been playing around with Camera2D today for a new game I've been working on and, while looking for answers, stumbled onto a HeartBeast video where he moves the Camera2D node away from the player in the scene tree but keeps it connected. Different setup from you, but maybe the RemoteTransform will help you?