Make a node 2D appear over CanvasLayer children

Godot Version

4.2.2.stable

Question

Hi everyone !

Glow_issue

As you can see in the GIF, if I put my correctly glowing nodes in a CanvasLayer, they stop glowing. So I need them out of the CanvasLayer, but still visible. Or inside the CanvasLayer, but still glowing.

So, short version is :
I’ve got a sprite (Sprite2D) that I want to make visible in my scene without putting it in a CanvasLayer. But I already have a CanvasLayer with things like a background, and they have to be in a CanvasLayer.
How would I go about doing that ?

Long version :

I have a scene (2D top-down view) where I want 2 things :

  1. small lights wandering and illuminating the BG ==> working

  2. particles that glow ==> stuck

  3. I got a CanvasLayer with my BG sprite and a CanvasModulate that makes it darker. On another CanvasLayer I’ve got my lights sprite and the lights work just fine to show the color of the BG without the tint of the CanvasModulate. All working as intended

I hide all other present things, put a WorldEnvironment node, set it up correctly for glow, set up a testing Sprite2D, the sprite glows. Everything is fine.
I show the rest, the sprite doesn’t appear, it is underneath the CanvasLayer whatever it’s z index visibility is.
I put the sprite in the CanvasLayer (without the CanvasModulate) and it appears… But doesn’t glow anymore.

Once that is working I’ll try to get particles glowing ^^’

I seems that a glowing Sprite2D or TextureRect when put as children of a CanvasLayer can’t glow. So I need them out of a CanvasLayer. But I need to keep the rest in CanvasLayers to keep my dark illuminated BG.

Steps to reproduce :

  • Make a new empty scene
  • Add a WorldEnvironment, set the glow settings on, background mode as Canvas etc
  • Add a Sprite 2D, set its Visibility > Raw > 1.1 just to be sure
    ==> it glows !
  • Add a CanvasLayer, set it up to take the whole screen
  • Add a ColorRect as child, set it up the same
    ==> the sprite disappears
  • Set the sprite as child of the CanvasLayer
    ==> Sprite appears but doesn’t glow

In any case, thank you very much for your time !

1 Like

Two things to try - change the order in the tree or adjust the Z index.

One of those options should work! :laughing:

1 Like

Thank you for your suggestions, unfortunately I’ve already tried both and it doesn’t work :confused:

1 Like

Have a look at some of my work on itch.io - one of them might be similar enough to what you;'re trying to do. If so, I can provide the scene tree.

Unchanted Forest is my current testing project.

1 Like

Hi, sorry for the long break.

I’m sorry, I looked at the two games released under your name on itch.io, and “platform game test” seems similar in one regard : your character has a light around themselves. My problem lies further than that : keeping that light, try to make anything glow. Like your gold pieces for example. I didn’t see anything glowing in your example, so unless I missed something, it doesn’t help me much.

1 Like

The pineapples have a slight glow to them. I decided against having the coins glow as they are bright enough already.

The snowmen in level two have a glow to them, and in my RPG demos i have e lot of 2D pointlights.(ie unchanted forest)

Are you looking for lights that cast shadows? That’s a lot more work but looks really nice.

1 Like

The pineapples have a slight glow to them. I decided against having the coins glow as they are bright enough already.

Then please yes, I’d like to see your hierarchy !

Are you looking for lights that cast shadows? That’s a lot more work but looks really nice.

I could add that with a few clicks already but I’m in a top down view with only trees to cast the shadows, I tried it and it looks very weird ^^
There, so you can see where I’m at currently :

Settlement_MenuScreen_particles

I saw only two projects to your name on itch.io, and no unchanted forest. Maybe you should look again at your sharing parameters ?

1 Like

I was having the same problem but found a solution. So with control nodes they have their Z indexing, but I’m guessing that only works around other control based nodes. Idk why it doesn’t work, nor does node hierarchy seem to affect anything.

When fiddling with the canvas layer, I noticed it has its own layering property called “Layer”. Idk why this isn’t called zindex, it doesnt seem to work interact with any other zindex; but I put that to -1 and it went behind all my other Node2D stuff.

Looking into it a little bit further it seems to be the “zindex” of canvas layers but only with canvas layers. I am unaware if there is a way to have it layered in between two different Node2D nodes.

tldr; Inside of the canvas layers properties change the layer value to -1 and it should hide behind all Node2D’s.

Hope this helps!

2 Likes

You, my good human, are a benevolent evil genius. One step closer to the end !
It doesn’t solve my problem though ^^’

1 Like

So, next step needed !

As @singem helped me find out, I can now get a glowing thing (sprite here, objective : particles) be seen over a background inside a CanvasLayer.
New problem : the light system I had working ( = black CanvasModulate on the background + PointLight2D on another layer, higher visibility order value) doesn’t work.

Settlement_MenuScreenParticles_NotWorking

Does anyone know if changing the z order to be negative throws the lights in disarray ?

1 Like

So I am not sure exactly what issue in particular you are having as I cannot see the full tree diagram of your root scene node.

I made a short gif(as i am a new user and cant upload a video version of it) to illustrate that there is a zindex and a layer section as well inside of the given point light. So that will change how it interacts with the canvas layers.

2024-09-2717-56-45-ezgif.com-optimize

If this does not solve the problem, I would be interested to hear more about what exactly the issue you’re having is in more detail!

P.S. the gif looks like it got cut off. I recommend right clicking it and opening it in a new tab to see the full scale and duration of it.

1 Like

That’s it ! You’re amazing !

It was the min Z layer and max Z layer. The min was at 0 by default, and I had forgotten these even existed, so I didn’t change them. Now I’ve put the min at minus something and I’m gonna go and try to see if I can get the glowing particles I was aiming for all along

And it’s working !

Settlement_MenuScreenParticles_short

Thank you very much for your time @pdhales72 and @singem !

That looks amazing! :smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.