> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/godotengine/godot/llms.txt
> Use this file to discover all available pages before exploring further.

# Viewport

# Viewport

**Inherits:** Node \< Object

## Description

Abstract base class for viewports. Encapsulates drawing and interaction with a game world. A Viewport creates a different view into the screen, or a sub-view inside another viewport.

## Properties

<ResponseField name="transparent_bg" type="bool" default="false">
  If true, the viewport should render its background as transparent.
</ResponseField>

<ResponseField name="msaa_2d" type="MSAA" default="MSAA_DISABLED">
  The multisample antialiasing mode for 2D/Canvas rendering.
</ResponseField>

<ResponseField name="msaa_3d" type="MSAA" default="MSAA_DISABLED">
  The multisample antialiasing mode for 3D rendering.
</ResponseField>

## Methods

### get\_camera\_2d

```gdscript theme={null}
Camera2D get_camera_2d()
```

Returns the currently active 2D camera.

### get\_camera\_3d

```gdscript theme={null}
Camera3D get_camera_3d()
```

Returns the currently active 3D camera.

### get\_mouse\_position

```gdscript theme={null}
Vector2 get_mouse_position()
```

Returns the mouse's position in this Viewport.

### get\_texture

```gdscript theme={null}
ViewportTexture get_texture()
```

Returns the viewport's texture.

### set\_input\_as\_handled

```gdscript theme={null}
void set_input_as_handled()
```

Stops the input from propagating further up the SceneTree.

## Signals

### size\_changed()

Emitted when the size of the viewport is changed.

## Example Usage

<Tabs>
  <Tab title="GDScript">
    ```gdscript theme={null}
    var viewport = get_viewport()
    var mouse_pos = viewport.get_mouse_position()
    print("Mouse at: ", mouse_pos)

    # Get viewport texture
    var texture = viewport.get_texture()
    ```
  </Tab>

  <Tab title="C#">
    ```csharp theme={null}
    var viewport = GetViewport();
    var mousePos = viewport.GetMousePosition();
    GD.Print("Mouse at: ", mousePos);
    ```
  </Tab>
</Tabs>
