[UPBGE0.36]4Camera viewports to display

Опубликовано: 19 Май 2026
на канале: Blender [BGE] (Light Rays Underwater)
84
10

Download .blend's file
https://drive.google.com/drive/folder...

import bge

def setup_split_screen():
Get the current scene
scene = bge.logic.getCurrentScene()

Get the four camera objects
camera1 = scene.objects['Camera1'] # Replace with your actual camera object names
camera2 = scene.objects['Camera2']
camera3 = scene.objects['Camera3']
camera4 = scene.objects['Camera4']

Get the window size
width = bge.render.getWindowWidth()
height = bge.render.getWindowHeight()

Set viewport for Camera 1 (top-left quadrant)
camera1.useViewport = True
camera1.setViewport(0, height // 2, width // 2, height) # Top-left

Set viewport for Camera 2 (top-right quadrant)
camera2.useViewport = True
camera2.setViewport(width // 2, height // 2, width, height) # Top-right

Set viewport for Camera 3 (bottom-left quadrant)
camera3.useViewport = True
camera3.setViewport(0, 0, width // 2, height // 2) # Bottom-left

Set viewport for Camera 4 (bottom-right quadrant)
camera4.useViewport = True
camera4.setViewport(width // 2, 0, width, height // 2) # Bottom-right

Call the setup function
setup_split_screen()