Strange normals

Hello! I’m having a strange normals problem.

[Have to remove video now it’s resolved]

The normals have been recalculated to face outwards and look okay in Blender. If I use no material they look fine. If I use the PBR material with no textures it looks wrong. The normal map is in tangent space.

I tried reversing the normals and it looks much worse, so it’s not that.

Is there a way to make the material two-sided to get around this? What is likely to be wrong with it?

It looks like faces invert?
I think you can try to invert faces?

I’ve already tried that and it made it appear completely inverted. I’ve also verified that the normals all face the right direction before exporting it to GLB. This feels like a PBR material problem.

can you have a check for PBR.cullBackFaces?

backFaceCulling was set to true. Setting it to false made the model look inverted.

So, I flipped the normals and re-exported the mesh. It looks exactly the same. So the normals are broken no matter what I do.

I wonder if there’s a problem with the API I’m using to host my model and it’s just not updating.

That’s too strange, I think I need @sebavan

I’m going to verify tomorrow morning that the file is actually changing, feeling too lazy to change where it’s coming from. I’ll know more then.

What are the transparencyMode & the alpha values of your material?

Null and undefined respectively. What should they be?

I was asking because your issue looks like an alpha issue. Try forcing transparencyMode to 0 (BABYLON.PBRMaterial.MATERIAL_OPAQUE), and alpha to 1.


That did it! Between that and removing backface culling it’s helped a lot.

It looks like one of the original issues I had is caused by geometry/normal mirroring, so I’ll have to go back to the original geometry and keep the material two-sided in order for it to look right, but that definitely got me 99% of the way there. Thanks everyone!

1 Like

Make sure your mesh scale is normalized, it should be [1,1,1]. If not, do an “apply scale”

Sorry I mean internal mirroring - there are mirrored, overlapping UV islands. Not my favourite optimization technique when it comes to normals. Once I restore the original unaligned normals it should be good now.

I still have an odd problem to do with face normal lighting.

The model I’m using has mirrored UVs and so mirrors the texture data.

This is how it looks if I apply the normal texture as a diffuse texture with no bump mapping (just to visualise it):

And this is how it looks if I turn the bump map on using that same normal texture:

And here it is with the normal texture as a bump map and the correct diffuse:

I guess the Y component of the normal map needs to be inverted some of the time. Going back to my mesh I finally found how to explicitly show normal facing in Blender and they’re all aligned and facing outwards. Any suggestions on how to improve this? I don’t really want to have to get these models all the way back into something like Substance Painter and re-unwrap, re-bake the texture then fix it by hand.

I could fix the Y orientation with an object space test in a custom webgl shader but then I’ll lose any PBR material and lighting support in the process making a normal map useless.

Are you using a normal map node? image

And also, during the bake of your normal map, are you using only half of the mesh?

I’ve only just discovered that the node editor is a web-based tool today (before I didn’t have the foggiest clue for six months how to find it) and I’m told that it isn’t supported in Babylon 4.5, so probably no chance of using it.

I’m not baking the normal map, this asset is straight from a marketplace. I’m currently trying to project it into a non-overlapping UV layout in Substance Painter so I can fix it up manually but I’m not having much luck getting it to project between UV maps.