godotengine / godotengine/godot-docs

Improve description of `size` and `size_2d_override` for `SubViewport`

Open
#10,343 0 comments 0 reactions 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:** 4.4

**Issue description:**

Possibly related to #5842.

The documentation for `SubViewport.size` and `SubViewport.size_2d_override` is rather lacking. They seem like they largely just restate the name of the properties without extra elaboration on what they do. The key points I've picked up on from experimenting with `SubViewport`, which I don't feel are sufficiently explained, are:

- If `size_2d_override` is a zero vector, then `size` defines both the *"world size"* and the *output resolution* of the texture generated by the SubViewport.
- If `size_2d_override` is a non-zero vector, then it defines the *"world size"*, and the `size` property defines only the *output resolution*.

My use case for this is that I'd designed some scenes meant to be played through a SubViewport, where objects were placed for a 1920x1080 screen size. However, I wanted to render the SubViewport at a smaller resolution for performance reasons. To accomplish this, I had to use the following settings:
- `size = Vector2(480, 270)` (the actual resolution of the texture I wanted the SubViewport to produce)
- `size_2d_override = Vector2(1920, 1080)` (the size I wanted the in-game world to act like it was rendering to)
- `size_2d_override_stretch = true` (not certain what/how much this contributed? need to do more research)

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_subviewport.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.