Light2D used as a mask for Particle2D still appears in scene

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

Update: I have answered my own question: I had to set the Item Cull Mask on Light2D to match the Particle2D node and nothing else. That did it! https://docs.godotengine.org/en/stable/classes/class_light2d.html#class-light2d-property-range-item-cull-mask

Question for anyone who knows about Light2D masking here. Here’s a video of my problem (ignore me saying animation, it’s not really an animation :grin: ). The basics are: my Light2D mask of a Particle2D node looks good in the editor, but in-game the entire light (just a white rectangle) flashes. It masks the particle, but is also illuminating the scene, which I don’t want. I just want to mask the particle. Turning off Light Mask on the tileset does not change anything.

I have referred to the demo project and AFAIK my settings match and other questions on here.

I tried using ViewportContainer > Viewport (for the first time) for this also, but didn’t get anywhere. For some reason the Viewport would only show the bottom half (not the top as I want), and it was very pixelated. I obviously did not configure it properly.

Scene tree:

TurnDust [Node2D]
  DustParticle [Particle2D]
  Light2D
  Turn [AudioStreamPlayer2D]

DustParticle non-default relevant settings:

  • Material = new CanvasItemMaterial
  • Blend Mode = Mix
  • Light Mode = Light Only

Light2D non-default relevant settings:

  • Texture = plain white square
  • Energy = 2
  • Mode = Mix

I also posted on the Discord.

Thanks!

:bust_in_silhouette: Reply From: fizzyted

I updated the question, but just to mark this as answered:

I answered my own question: I had to set the Item Cull Mask on Light2D to match the Particle2D node and nothing else. That did it! https://docs.godotengine.org/en/stable/classes/class_light2d.html#class-light2d-property-range-item-cull-mask