godotengine / godot

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

Postprocessing/tonemapping does not work with Viewport + Transparent Bg #45208

Closed vitorbalbio closed 2 years ago

vitorbalbio commented 3 years ago

Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version: Stable 3.2.3 Mono

OS/device including version: Windows 10

Issue description: World's post process do not work with Viewports when Transparent BG is enabled. That included Tone mapping and color correction not only FX

Godot_v3 2 3-stable_mono_win64_gcO4YSVZ5R Godot_v3 2 3-stable_mono_win64_n0NnmC0Wqx

Steps to reproduce: Bellow

Minimal reproduction project: Run the project. Check option with and Without Transparent Bg PostBug.zip

Calinou commented 3 years ago

I think this is a design decision. I doubt post-processing effects can be made to work with a transparent viewport.

vitorbalbio commented 3 years ago

I think this is a design decision. I doubt post-processing effects can be made to work with a transparent viewport.

I think it's more like a feature lost in the way when it was implemented since i can get a Viewport Texture with alpha channel and apply a custom shader to it with Color Correction per example. Beside that it have too much limitations to be a solution since i can't do a simple Glow because i can't access the mipmap levels of the Viewport Texture (Even when those are correctly created) but this is another problem https://github.com/godotengine/godot/issues/23417. Looks like a dead end here to have Viewport Texture with alpha + Glow

Arnklit commented 3 years ago

In my case some of the world environment works, but not all. Glow Works, Fog Works. Tonemapping, SSAO, DOF do not work. This definitely feels more like a bug than design decision.

farfalk commented 3 years ago

This feels a lot like a bug, at least from an usability standpoint. I'm using different viewports with different cameras and the same world, mixed together using overlapped TextureRects, and I'm using this structure to replicate this effect: https://youtu.be/LAopDQDCwak

In practice, I render everything but some objects in a viewport via cull masks, and those objects in the other one with transparent_bg enabled. I'd love to put some effects in both of them, but I just.. can't, and it feels wrong.

I'm currently trying some chromakey to achieve transparency without transparent_bg, but it's cumbersome

djmaesen commented 2 years ago

same problem in 3.4.2 in my fps project. enabling transparent background disables post processing and fxaa and msaa

Calinou commented 2 years ago

same problem in 3.4.2 in my fps project. enabling transparent background disables post processing and fxaa and msaa

Could you test https://github.com/godotengine/godot/pull/54585 by building its branch from source (https://github.com/Kinwailo/godot/tree/fix_viewport_transparent_bg)? See compiling instructions here: https://docs.godotengine.org/en/stable/development/compiling/index.html

djmaesen commented 2 years ago

same problem in 3.4.2 in my fps project. enabling transparent background disables post processing and fxaa and msaa

Could you test #54585 by building its branch from source (https://github.com/Kinwailo/godot/tree/fix_viewport_transparent_bg)? See compiling instructions here: https://docs.godotengine.org/en/stable/development/compiling/index.html

sorry man , im not a coder i have no idea to implement that in my project

djmaesen commented 2 years ago

godot4 alpha fixes the environment effects on second camera however, transparent background doesnt work anymore when using viewports

Calinou commented 2 years ago

godot4 alpha fixes the environment effects on second camera however, transparent background doesnt work anymore when using viewports

This issue is being tracked in https://github.com/godotengine/godot/issues/40651.

akien-mga commented 2 years ago

Fixed by #54585.