godotengine / godotengine/godot
Child of SubViewport is drawn to root viewport
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in : v4.2.1.stable.official [b09f793f5]
### System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 31.0.15.5161) - AMD Ryzen 7 5800H with Radeon Graphics (16 Threads)
### Issue description
in the docs at https://docs.godotengine.org/en/stable/tutorials/rendering/viewports.html#cameras-2d-3d

"CameraA will display on the Root Viewport and it will draw MeshA. CameraB will be captured by the SubViewport along with MeshB. Even though MeshB is in the scene hierarchy, it will still not be drawn to the Root Viewport. Similarly, MeshA will not be visible from the SubViewport because SubViewports only capture nodes below them in the hierarchy."
When i make the same setup as in the docs, both meshes are visible with both cameras (if i do not set render layers and cull masks - which can be tricky and seems to not even be possible for the editor viewport).
That camera b can see what is above it's viewport is necessary, as otherwise rendering to a subviewports would be kind of meaningless (e.g needed for post processing shaders as a buffer replacement). The other way round i am not sure ... and both contradict the docs. I am not sure what is wrong, the way subviewports behave or the docs.
### Steps to reproduce
Copy the setup from the docs (screenshot above).
### Minimal reproduction project (MRP)
[bug.zip](https://github.com/godotengine/godot/files/14475587/bug.zip)
Contributor guide
Research direction
Start with the linked Viewports documentation section and reproduce the setup using the attached bug.zip project. Compare the documented camera and SubViewport visibility behavior with the actual result, then update the documentation or engine behavior so the explanation and reproduction agree.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100