Glow + Other mesh overlap

Hello everyone, my name is Kate, I am new here. Wasn’t sure where to post this question, as probably it is not a bug but a lack of my knowledge, so decided to do it in this section. Also did my search through the forum, but wasn’t able to find a similar issue.

In short, I have built a scene with an animated celestial sphere, Earth, Moon, and a few asteroids.
Earth has a glow layer. When I place the asteroids in front of the Earth, they interfere with its glow layer, so I have tried to exclude them, but the exclusion resulted in a strange arch-like artifact crossing an asteroid. Could you please advise? I also tried to increase the distance between the elements maximally because was thinking that maybe the HL/asteroid overlap causes the problem… Should I just make them very distant?

 var hlE = new HighlightLayer("hlM", scene);
 hlE.addMesh(Earth, new Color3(0.61, 0.83, 0.97, 0.43));
SceneLoader.ImportMesh("", "/model-assets/", "Asteroid3.babylon", scene, function (newMeshes) {
	            const meshRecord = newMeshes[0];
	            meshRecord.position = new Vector3(-4, 1, -4.5);
	            meshRecord.scaling = new Vector3(1, 1, 1);
	           	//Added this line to elemenate the highlighter but the earth highlighter is overlapping       
       		SceneLoader.ImportMesh("", "/model-assets/", "Asteroid1.babylon", scene, function (newMeshes) {
                const meshRecord = newMeshes[0];
                meshRecord.position = new Vector3(-1.4, 2.5, -7.5);
                meshRecord.scaling = new Vector3(0.3, 0.3, 0.3);
 				//Added this line to elemenate the highlighter but the earth highlighter is overlapping       

Thank you.

Welcome aboard!

You can use two cameras, one that displays the earth and the other that displays the asteroids:


Wow, thank you so much, Evgeni! Will try that! I have the good feelings about this forum ^^. First time in the longer period I see such a friendly online environment, thank you for that. BTW. Originally I am a designer, so may be a bit code-dumb sometimes (or rather frequently) :wink:

1 Like

Welcome @kate!

The above suggestion is good, have you alternatively tried assigning the earth material an emissive color or texture? Instead of a highlight layer, you’d use a glowlayer, but you’d still add the asteroid to the excluded mesh list.

Create the GlowLayer like this: let gl = new GlowLayer(“earthshine”); instead of the HighlightLayer


1 Like

Yes I was playing with that and fresnel, but couldn’t get not too overexposed effect I would like. (my lack of capabilities for sure). Thank you for your suggestion, maybe should check it further !

Are you looking to have the earth glow reflected by the asteroid? Emission/glow does not participate in that part of the lighting calculations, so you can use a point light with the color and intensity set appropriately to get the reflected light from the planet to look like you want

1 Like

By default, they are pretty matte, but a delicate reflection could be a nice touchup still, worth to check it out thanks! :slight_smile:

1 Like

This sounds reasonable. Else, you could try a nicely set lens flare effect (or even combine both for the outmost emotional effect:) Did I mention your asteroids & earth look quite nice? Now, I did:)

1 Like

Yes, on the edge it could look awesome, thanks for the idea, need to take a look at how to achieve that ;). Haha, thanks, the asteroids are just the placeholders yet, but glad they look anyhow tolerable…

Oh, they sure do. And then, note that we are mostly friendly people here in this forum. We try to encourage people and not challenge’em on the first post :wink: Though, now that you tell us that this is just the placeholder, I’m really eager to see the final result :slightly_smiling_face: GL with your project and welcome to BJS,

1 Like

You definitely are! Honestly I am a bit (positively) shocked. Being in my late thirties now, in the past I was used to IRC and the forums like that, full of ‘nerdy’, passionate, helpful and friendly people (also tried to be one of them in the area of my expertise…) then years after something strange happened and I started noticing a lot of really not nice communication among the members of some forums (of course not all luckily!), some of them were closed when the social media era came, and in fact I didn’t use any from the loooong time. Babylon don’t have even 10 years yet as far as I know so TBH was a bit frightened of posting, therefore thank you so much for such a warm welcome! If my boss will allow I will share the final result with you for sure ^^ Thank you again, and hear you soon. Kat

1 Like

I can hear you on that. I’m sure many of us in this forum can hear you on that. We didn’t want the Internet to go this way, now, did we?

Lucky you. You wouldn’t know how much good it did to you to evade this period:)

Personally, I made my first post on the forum only after 4 months of studying BJS. I simply didn’t feel the need or the purpose to post before that. It’s all a very personal thing, isn’t it?
Cya and have a great day,

1 Like

Hahaha, good to know I wasn’t insane ;)) Have a good day.

Hi fellows! That’s me again :wink: Have a question. Am I doing something bad, or for mesh import there is another way to go? Sorry for being such a dork.

Why did you comment meshRecord.layerMask = 0x80000000;? It’s what you need to do to remove the asteroid from the layer:

1 Like

Sorry! Sent a wrong link, was commenting on and off to see if the change is happening. Maybe it was somehow stuck in my browsers (the same object used before, refreshed view multiple times, but didn’t clear cache fully tho), because from your link and refresh started to work! Magic. Thank you so so much.

Hi good people, I have an awkward question, because I am really amazed by you and aware of my limitations, wanted to ask if anyone would like to help me to finish the work and make that truly amazing together? (I will provide any requested models/textures of course). I am a bit overloaded with my design work and would need to learn yet a lot in a pretty short time, sadly my fellow developers are also not very fluent with Babylon, so I am a bit alone with that. Of course I am proposing a normally paid job, not a voluntary service :wink: Please DM me if you would be interested. Of course you may be crazy busy being such good, but always worth to try :wink: @Evgeni_Popov @mawa

@jelster Sorry system doesnt allow more than 2 mentions for me at once.

You should post in the “Service offers and requests” category for better visibility.

Thanks! Waiting yet a bit as my boss is interviewing someone. I wish I had way more time for Babylon, it is such a cool tool.