hcmetal Posted October 17, 2018 Share Posted October 17, 2018 Hello everyone, I am trying to find a way to properly occlude the glow effect. Consider: from the other side: 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! Quote Link to comment Share on other sites More sharing options...
Sebavan Posted October 17, 2018 Share Posted October 17, 2018 As you only include the lamps, the occluder are not rendered in the layer. In order to add the occluder, and therefore glow occlusion, you either need to simply call add vs add includedonlymesh or you also need to addIncludedOnlyMesh for the occluders. hcmetal 1 Quote Link to comment Share on other sites More sharing options...
hcmetal Posted October 17, 2018 Author Share Posted October 17, 2018 Ah, silly me. It is unnecessary to use addIncludedOnlyMesh method in this particular case. The glow layer only affects emmisive materials. Quote Link to comment Share on other sites More sharing options...
Myjestic Posted November 13, 2018 Share Posted November 13, 2018 Hi, same problem here: https://playground.babylonjs.com/#QLBNSV Can you please provide an example to show how to prevent the glowing sphere shining through the second sphere? And by the way, how can I change the glow color for all meshes using glow layer? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
hcmetal Posted November 17, 2018 Author Share Posted November 17, 2018 @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! Myjestic 1 Quote Link to comment Share on other sites More sharing options...
Myjestic Posted November 17, 2018 Share Posted November 17, 2018 I was so close to solved it by myself. So easy... if you know how to. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
hcmetal Posted November 18, 2018 Author Share Posted November 18, 2018 Welcome! I have the same 'Damn, so close...' feeling all the time. Sometimes as I am typing up a question to submit on the forum or making a PG, I suddenly figure out how to solve the problem myself. Sebavan 1 Quote Link to comment Share on other sites More sharing options...
Indra Posted June 21, 2021 Share Posted June 21, 2021 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.