How do you set a mesh's emissive color to nothing?

So now I’m playing with GlowLayer.

I found an old playground someone put up and modified it to illustrate what I’m trying to do.

Basically I want to:

  1. Be able to click on a mesh and it to glow.
  2. Have only one mesh at a time be glowing.
  3. Clicking off into space will cause the currently glowing mesh to stop glowing.

I understood (mistakenly?) that the GlowLayer would find the meshes that have emissive colors added to their materials. My logic was that I could by capturing the mesh clicked, could add the emissive color to get the glow, then remove the emissive color by clicking anywhere else and the mesh would stop glowing. Some of it kind of works.

Here’s my PLAYGROUND

Thank you!

Hi Carlos.Mendieta,

Does this work as intended? https://playground.babylonjs.com/#5QP4GC#1

I only changed a few things from the Playground you provided:

  • Switched the event type to POINTERTAP, as I was getting event activations when I released the mouse after dragging, too.
  • Separated the if-else statement into two if statements. This way, even if the click is a hit on one sphere, the current glow mesh will still be updated properly.
  • Set the “unselected” glow mesh’s emissive color to clear, which seems to cause the desired behavior.

Is that the effect you were going for?

1 Like

beautiful Synth. Thanks so much. I especially appreciate the explanation!