Jump to content

How to occlude glow effect


hcmetal
 Share

Recommended Posts

Hello everyone,

I am trying to find a way to properly occlude the glow effect. Consider:

glow01.jpg.64e1db51dec9e65edf308f3a2ae51121.jpg

from the other side:

glow02.jpg.992b75db954bc269b05b61ecfc5bf9af.jpg

The glow effects are not occluded by the walls and other opaque objects.

Related code:

const lamps = scene.getMeshByName("hotel_lower_lamp");
const glow = new BABYLON.GlowLayer("glow", scene);
glow.addIncludedOnlyMesh(lamps);

Just to be sure, I have also set opaque materials:

material.transparencyMode = 0;

Hope someone can point me to the right direction.

Thanks alot!

Link to comment
Share on other sites

  • 4 weeks later...

@Myjestic,

As shown in PG: https://playground.babylonjs.com/#QLBNSV#2

1. Include sphere1 in the glow layer, and set its material's emmissiveColor to black. Then sphere1 will occlude sphere2's glow effect.

If you want both spheres to glow, consider setting their emmissiveColor to different colors or intensities. Don't over-blow the exposure so you can see the "occluded" effect.

PG: https://playground.babylonjs.com/#QLBNSV#3

2. You can use the sphere materials' emmissiveColor to control the glow color, or use "gl.customEmissiveColorSelector" on the glow layer.

Doc: https://doc.babylonjs.com/how_to/glow_layer#controlling-glow-color-per-mesh

Hope this solves your problems. Please let me know if there are any further questions.

Cheers!

Link to comment
Share on other sites

  • 2 years later...

I am not sure the solution described above is a good one. If I have a lots of objects in the scene,  I have to add many objects to the glow layer so that glowing objects does not shine through them. It is 2021 and I hope someone has a better solution than the one above. Thanks in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...