godotengine / godot

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

Local to Scene ViewportTextures proxy is invalid. #68371

Open EMBYRDEV opened 1 year ago

EMBYRDEV commented 1 year ago

Godot version

4.0 beta 4

System information

Windows 11, Vulkan, RTX 2070Super

Issue description

I am porting over a setup that I had working in Godot 3.5 for rendering the world at a lower resolution and then upscaling without pixel jitter that involves using two viewport textures. This works in the editor but when the game launches I get the following errors and I am met with a black screen.

Screenshot_35

Steps to reproduce

Screenshot_32

Screenshot_33

When the game is launched you will be met with a black screen.

Screenshot_34

Minimal reproduction project

project.zip

Calinou commented 1 year ago

Note that rendering 2D and 3D at different scale factors is supported out of the box in 4.0.beta (Scaling 3D project settings), but nearest-neighbor filtering isn't implemented yet for 3D scaling.

EMBYRDEV commented 1 year ago

Note that rendering 2D and 3D at different scale factors is supported out of the box in 4.0.beta (Scaling 3D project settings), but nearest-neighbor filtering isn't implemented yet for 3D scaling.

Yeah I'm very specifically rendering at a low resolution, blitting it to a buffer 4x (although the ideal multiple is floor(screenSize / nativeRes)) it's size to maintain pixelation and then stretching that texture using bilinear filtering so that I avoid issues with different screen sizes that aren't multiples of the native res having inconsistently scaled pixels.

Nearest filtering on the native viewport resolution would lead to undesirable side effects for me.

(Take any game that does that and you'll see that pixels aren't all the same size and the game will shimmer as you resize the window)

EMBYRDEV commented 1 year ago

Reproduced on macOS 13, M1 Max.

EMBYRDEV commented 1 year ago

When running in gl_compatibility mode the viewport does render but incorrectly. The color of the cube is not deterministic but I get cyan most often. I have had it render the cube correctly only once however the world environment was not respected.

image

Rindbee commented 1 year ago

Error messages could be fixed by #64388.

The rest of the problem can be solved by adding the environment and sun.

https://user-images.githubusercontent.com/30386067/200495932-c64ebdf5-9f3a-49bb-8790-ad336feba7ca.mp4

EMBYRDEV commented 1 year ago

Error messages could be fixed by #64388.

The rest of the problem can be solved by adding the environment and sun. 0.mp4

Ahhh derp! I assumed the default world env would pass through but that's my bad. Obviously the error messages are still a problem but this unblocks me.

eh-jogos commented 1 year ago

Error message still happening in 4.0rc2, was going to report this today but just found this older issue.

Gegbee commented 1 year ago

Can confirm that this error is happening in Godot 4.0 stable. Though it does not interfere in in editor play mode, exporting the project does not work because the viewports do not show up.

Rindbee commented 1 year ago

The error message was fixed by #75751.

clayjohn commented 1 year ago

Can anyone reproduce this in 4.1 beta 1?