How to deal with this model?

The model is ok in sketchfab, I don’t know why it’s transparent in babylon, and how to let it glow?

can I have your help?


probably you need to reset the emit property of the material after loading the mesh?

Hi,
I believe the issue comes from that the entire texture is a wrap and uses the alpha from the diffuse for blending. I don’t think you can use the ambient texture as occlusion to mix between opaque and alpha blended when using the diffuse as an alpha (though I might be wrong). I admit if I was to use an opacityTexture for the occlusion/transparency of the shell, it would work (it should work).
As for the glowing part, you can use the glow layer but it’s pretty performance consuming. It will double all draw calls. You could create a mask for the glow layer or else, may be better, not merge all meshes together and apply the glow only on the glowing meshes. Else, you can of course still simulate a glow fx by adding an offseted mesh with opacity around the glowing object or use material zOffset and create a ‘light material/texture’ with an opacityTexture (and eventually a fresnel). You can also push the emissive of the glowing object/material above 1 and use directIntensity (direct light intensity) pushed beyond the reasonable limit (up to 10 or a 100). Of course the glow or highlight layers FX will always look better than the above trick but as I said, beware the use of resources for these effects.

2 Likes

Thank you

Sry, didn’t realize you already had the alpha select in your albedoTexture.
Then, all you have to do is to add a depth pre-pass to it and it will work

But you will still need to add a mask to the glow layer if you want to use it (because the glow layer renders on top and will not take the depth pre-pass from the material (sadly)

1 Like

@mankeheaven you should check with Sketchfab why they export the GLTF a alpha blended I guess ?

Thank you for your help and patience

Now my firefly snail’s head is penetrated by light, how can I correct it?

I am a benginer in web3d, and I am interested in babylonjs, I want to know everything about this. Thanks for your work in babylonjs

If i change mesh.material.transparencyMode=1, It would like this, snail shell broken

I don’t know what’s wrong

1 Like

Actually, it isn’t. What you see is the glow layer rendering on top of the object. Also the glow is applied to the entire mesh. As briefly exposed in my last post, the issue with the glow layer is that it cannot be worked through the material (i.e. an opacity texture). It’s a (fairly old) post-process fx that renders on top of the scene. The only way to create a mask on it is through the rendering of two cameras.

However, the glowLayer has a property similar to lights. You can include or exclude meshes from the glow layer. Now, for this to work on your snail, you would need to not merge everything together (though, I didn’t check your object so if you have submeshes then you could select through the submesh). Else, I believe the easiest would be to merge all of your non-glowing meshes and merge and parent to your snail all parts you want to glow. This way you can include only the glowing mesh/submesh(es) in the glow layer.

There is still another issue though with the glow layer (sorry, not the best process for learning BJS :wink:) The issue is that when I say ‘mask on the layer’, it’s actually a bit more complex than a simple mask. In this aspect, the highlightLayer would be easier to handle but it is also even more performance consuming than the glow layer.

In order to mask the glow layer from the objects where you don’t want to see the glow showing through, you actually need to add them to the glow layer. Yeah, I know, it’s weird. The first two things to understand here is that 1) The glow layer is a post fx (layer) that always renders on top 2) The glow layer uses an emissiveColor, with alpha and intensity to create the glow.

The idea is to set a custom emissiveColor for the glow layer on these masking objects. This custom emissiveColor comes with an alpha of 0(zero). That’s the important part. So, read here that when the glow layer sets the emissiveColor on an object tagged to use an alpha of 0 then, since there is no alpha, there’s also no glow. This is the method I exposed in my rev of your PG below.

And then, there’s still another solution (there nearly always is :smiley:). You could create a node material for your glow layer.


Here’s an example/PG for you and if you want to tackle the subject in the forum, there are a number of interesting posts around this topic:

I hope this helps and I’m also happy to hear that you seem to enjoy your experience with BJS and

We love that spirit here and we’ll support you the best we can.
Meanwhile, have a great day :sunglasses:

In fact, this is the classic problem of sorting faces with transparent objects. You can alleviate the problem somewhat by turning on facet depth sort but there are still artifacts depending on the camera position:

The problem comes from the mesh, it should be divided into two parts, one for the shell and one for the body. The shell should have a transparent material but not the body.

Oh, thanks a lot. Looks like I learned something new here. :smiley:

Thanks again for let me know so much.