Open sriedi7 opened 5 years ago
I believe this is due to a problem in the way this rectangle is blended (kinda similar to https://github.com/godotengine/godot/issues/31124 but at renderer level).
In this situation, you could fix the blending by adding a material on your ViewportContainer
and setting its blend mode to Premult Alpha
:
Although the fact this is 99% of times what you'd expect that's not very intuitive.
Still valid in c3964b6
v3.4.2.stable.custom_build [45eaa2daf]
Still need to use the Premult Alpha
This seems like expected behavior to me. Setting the default CanvasItemMaterial blend mode to Premult Alpha may not be a good idea as it can break expectations (and it will look broken with most sprites).
More information on why you need to use premultiplied alpha when performing any kind of compositing (which includes transparent viewports).
Confirmed identical behavior in Godot 4.1,
example project also converts perfectly to godot 4.
I believe that pre-multiplied rgb values are incorrect in forward+ render textures- in compatibility however the values do come out as expected. this is a forward+ test showing the rgb result of grey+alpha
Godot version: Godot 3.1.1 stable (GLES2 & GLES3) Godot 3.2 a1 (GLES2 & GLES3)
OS/device including version: Windows 10 pro
Issue description: I have ColorRect with the same color (it's a duplicate, so they should have the same color). But when I move 1 of them to sub viewport (with transparent_bg = on, and the subviewport inside viewport container). The color become different like this: The duplicated color rect is the transparent white rect and 1 above it (become slightly darker).
Steps to reproduce: Open project below and open Coba.tscn
Minimal reproduction project: viewporttransparent.zip