0 votes

The problem of displaying light2d in a popup. Light and effects on sprites that react to it are displayed in the editor but remain invisible when the scene is rendered. The problem is demonstrated in the video at the link:


I use type Light2D and WorldEnvironment nodes to create a glow effect:

enter image description here

Since the light is not showing in the control nodes I added a Polygon2D node as a child to the scene with my images:

enter image description here

As a result of these actions, the light and its effects began to display correctly in the editor, but are still not visible in the render. I found that both nodes (Light2D and WorldEnvironment) are connected to the scene and are displayed on the render, but are displayed UNDER the dialog. Manipulations with z-index and render priority did not give results.

Please tell me how to solve this problem, or at least bring the Light2D and WorldEnvironment OVER the popup.

Godot version Godot Engine v3.4.stable.official, 2021
related to an answer for: My 2d Lighting Is Not Working
in Engine by (97 points)

1 Answer

0 votes
Best answer

I found the solution! :-) Maybe someone will have the same problem, so I write in detail about how to do it.

First of all, Light2D is not intended for use in control nodes, so it is better to try to get rid of it. But if you (like me) need light there, you can use this trick, which solves the problem of displaying lighting effects.

Place all elements that require lighting effects in a separate Viewport and display it at the right coordinates over the control nodes:

enter image description here

For your Viewport, set the parameter values:

size_override_stretch: true;
transparent_bg: true;
Msaa : 4x;
Fxaa : true;
render_direct_to_screen: true;

Also, specify the size of the Viewport correctly.

Done! I hope this information will be helpful to someone. Have a nice day!

by (97 points)
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.