godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.11k stars 20.2k forks source link

Render direct to screen option turns Viewport to black #76239

Open boruok opened 1 year ago

boruok commented 1 year ago

Godot version

v3.5.2.stable.official [170ba337a]

System information

Ubuntu 22.10 LTS, GTX1060, GLES2

Issue description

here is two same viewports with render_direct_to_screen enabled and disabled. Screenshot from 2023-04-19 09-10-36

Steps to reproduce

  1. open attachment
  2. toggle render_direct_to_screen option

Minimal reproduction project

New Game Project.zip

Calinou commented 1 year ago
clayjohn commented 1 year ago

Please take a look at the description for render_direct_to screen

In particular "If used, reading from the Viewport or from SCREEN_TEXTURE becomes unavailable". In your MRP you are trying to read from the Viewport even though you enabled render_direct_to_screen. Those two things are incompatible.

boruok commented 1 year ago

so, what use case of this option then?

clayjohn commented 1 year ago

It's used when you want to render the Viewport directly to the screen without using a ViewportContainer or a Sprite to read from it. This can be much more efficient on certain hardware. As the description says it is a niche optimization that shouldn't be used in most cases.