How to use light2d in control node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Wolchy

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.

:bust_in_silhouette: Reply From: Wolchy

I found the solution! :slight_smile: 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!