Hemi-light differences between generated and imported block

I have the following playground with an imported chair and generated box.
The hemi-light effects each differently. I can’t see any shading on the chair.

We are having the same issue with imported obj blocks in our application.
What are we missing?


Ok this is because there is no back face on your mesh:

using the vertex normal:

What about these two boxes? One is imported and one is generated. The imported one has had it’s normal’s computed.


The imported one has normals: yes but they are per faces as vertices are shared by faces (look the generated one has 36 vertices)

Okay I think I narrowed down my problem. I’m sorry I was not clear in my previous posts.

  • The .obj file I provided does not contain any normals.

  • BABYLON import loads the block and initialized a default normal array? A bunch of normals in the y-direction?

    ^ This line of code is equivalent to smooth shading?

I want to be able to know if there were no normals supplied. So then I can let the user decide on
smooth/flat shading.

In this case the best option is to set COMPUTE_NORMALS to false and then check after loading the mesh if there are normals with:


I tried that and I’m getting true back. https://www.babylonjs-playground.com/#95MJI8#29

I know the obj file does not have any normals. The normals I get back are all y-up (0,1,0).

Exported from 3D Builder

mtllib box.mtl

o Object.1
v -506.154510 -506.180054 1012.309021
v 506.154510 -506.180054 1012.309021
v -506.154510 506.179688 1012.309021
v 506.154510 506.179688 0.000000
v -506.154510 -506.180054 0.000000
v -506.154510 506.179688 0.000000
v 506.154510 -506.180054 0.000000
v 506.154510 506.179688 1012.309021

usemtl Regular_0
f 1 2 3
f 4 5 6
f 5 4 7
f 8 3 2
f 5 7 2
f 5 3 6
f 8 2 7
f 6 3 8
f 5 1 3
f 7 4 8
f 2 1 5
f 8 4 6

Oh yeah you are right! By default the normals will be filled with Vector3.up :frowning:

We were going to use that as our check to see if normals were not supplied. Wondering if there is a better way.

Not now but maybe we can add an observable or an option to disable populating by default

Alright, Thanks Deltakosh!

If you want to try, I will be happy to merge a PR :slight_smile: