Incorrect display HighlightLayer

Does not work addExcludedMesh

Hi @JohnDoe

If you want to highlight the planet only, just add the mesh to the layer like this:

addExcludedMesh makes the mesh transparent for the layer. So the highlight is visible over that mesh.

Not good (

Yes, the glow will cover details in front. I believe you want a glow that will only cover further geometry.

Summoning @PatrickRyan to see if it’s possible to make it better

Pinging @sebavan

Unfortunately there is no setup that would fix it here.

As @Cedric explained excluding meshes make them invisible to highlights and if you do not exclude them they will get the highlight effect over them.

You could try playing with rendering groups instead:

1 Like

Oh, no )

Would you mind detailing ? Why this solution does not fit ?

Sorry, everything is fine, I think a good solution

1 Like

@JohnDoe, I think @Cedric is right in that there is likely a better solution than using highlight mesh and that is because the atmosphere will not show up on the dark side of the planet like you see below:

I did a quick node material solution to take into account lighting in your scene with a technique that I stumbled into with the help of @sebavan.

I created a new node material that uses the mesh fresnel combined with the specular contribution of the lights to create a mask for an emissive color. To do this correctly in node material we are isolating the emissive color on the fresnel with a lerp value before the glow layer is applied and then switching it back to standard for the diffuse pass.

You have control over the color of the emissive color for glow as well as the fresnel bias and power to get the look you are going for. You can also adjust the glow intensity as you need. The nice thing about this approach is that your fresnel contribution will intensify as the scene light passes behind the planet so you can get some dramatic effects based on view angle. I also like the fact that I don’t have to worry about batching render passes per mesh, though I am going to need to set the emissiveSwitch variable per material for the glow layer that is fairly easy to do and you can even set up list of materials and loop through them to set the values all at once if you have several materials pointing the same shader.

Hope this helps and gives you some more ideas as to how to approach your assets. Let me know if you have questions.