Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Alpha channel not included in Viewport capture due to SCREEN_TEXTURE and DEPTH_TEXTURE not being updated #35230

Closed
supagu opened this issue Jan 17, 2020 · 5 comments

Comments

@supagu
Copy link
Contributor

supagu commented Jan 17, 2020

Godot version: Vulkan

OS/device including version: Linux/Arch/Manajro

Issue description: I have a ViewportContainer with a Viewport child to render something in the viewport. I have a custom ShaderMaterial applied to the ViewportContainer
with some code like this:

shader_type canvas_item;

uniform float width: hint_range(0.0, 10.0);
//uniform vec4 color: hint_color;

void fragment() {
	vec4 c = texture(TEXTURE, SCREEN_UV, 0.0);
        COLOR=c.aaaa;
}

image

the texture always comes out white.

what I am rendering in the viewport is a mesh with a material that is like so:
image

so that it draws in the alpha channel.

this worked fine when in the godot 3.2 branch and seems to have broken when I try it in Vulkan branch,

@supagu
Copy link
Contributor Author

supagu commented Jan 18, 2020

Additionally, I tried setting the environment clear color to (0, 0, 0, 0) but still all I see is white in the alpha channel.

@Chaosus Chaosus added this to the 4.0 milestone Jan 18, 2020
@supagu
Copy link
Contributor Author

supagu commented Feb 17, 2020

in fact any work I have tried to do with capture texture/depth capture has not worked well.

@briansemrau
Copy link
Contributor

briansemrau commented Jul 28, 2020

This issue is still relevant as of 7a31baf. After experimenting with spatial materials, it appears that SCREEN_TEXTURE and DEPTH_TEXTURE are not being updated with the new Vulkan renderer, resulting in texture calls returning a default value.

@Calinou Maybe this issue should be renamed and possibly labeled as a regression?

@Calinou Calinou changed the title Vulkan: Alpha channel not included in Viewport capture Vulkan: Alpha channel not included in Viewport capture due to SCREEN_TEXTURE and DEPTH_TEXTURE not being updated Jul 28, 2020
@flakusha
Copy link

This issue still exists.
Shader which does work correctly in Godot 3.2.3 does not capture SCREEN_TEXTURE in Godot 4 dev 94e5f66
Godot_v3 2 3-stable_win64_DAu4KqV7LL
godot windows opt tools 64_XwdTv0YFPl

@Calinou
Copy link
Member

Calinou commented Feb 20, 2023

This appears to be fixed as of 4.0.rc2, closing.

image

image

Testing project: test_shader_viewport.zip
(UV is used instead of SCREEN_UV for sampling, but it that's purely for cosmetic reasons.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants