0 votes

Hi!

My simiplified node tree is:

poly_1 (Polygon2D)
- blur_1 (Polygon2D)
poly_2 (Polygon2D)
- blur_2 (Polygon2D)

blur_1 and blur_2 (sub)nodes have ShaderMaterials (unique), with this simple shader code:

shader_type canvas_item;

void fragment() {
    COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, 3);
}

The first blur works properly, but the second is fully transparent... :(

Screenshot:
enter image description here

Sample project: google drive

(Godot v3.3 stable official, GLES3, Win10 64bit)

I don't know what I'm doing wrong.
Can you help me?

Thank you!

in Engine by (660 points)

Does the second shader have the same problem when it is used alone? Or does it depend on the number of shaders?

The second shader works alone :)

And it works immediately, when I hide the first one (no other changes):
enter image description here

I really don't understand, what's going on here...

Me either. I should probably check whole shader to see what's going on.

Whole shader? What do you mean?
This shader code has only 5 lines...

A changed it to:

COLOR = vec4(1,0,0,1);

And it works... interesting.
enter image description here

I thought it was one of the complex blur shaders where interpolation is causing the problem. But if this is the shader, then this could be a bug.

I think the SCREEN_TEXTURE is where the problem appears, maybe screen reading cannot be used more than once so the second shader just fails and returns nothing.

You are probably right.

I modified the code (without SCREEN_*):

(...)
COLOR = textureLod(TEXTURE, UV, 3);
(...)

... and the problem was somehow solved :)

Please write this again as an answer (not comment) , and I can select it as "best asnwer"!

Thank you!

1 Answer

0 votes
Best answer

The SCREEN_TEXTURE is causing the problem, screen reading shaders cannot be used more than once so the second shader just fails and returns nothing.

by (288 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.