Facet normals on glb

Hi,

I’ve been trying to get the facet normals to work on a glb, however they always seem to be not in the correct position (maybe flipped?).

Expected:

Result:

Same happens when for example, exporting the icosphere from the first example as glb (from the debugger tools), then importing and applying the same code, the normals are not correct:

For the second example, using the world facet positions solved the issue.

However I just realized it is not a GLB file but a .babylon. Using the world facet position doesn’t solve it for glbs.

Also tried, unparenting the auto-generated root node but this doesn’t seem to help.

Probably this PG may help - https://playground.babylonjs.com/#1YTZAC#236

Unfortunately, it seems to be the same error when applied to glbs

This playground shows the facet normals problem on a simple cube glb

Using the facet picker, the facets are on the correct position. However the normals are not.

BJS
image

Checking with Blender:

There is some transformation for left-handed system which I believe should be taken into account when comparing.
You may try scene.useRightHandedSystem = true to check.

Ok, I think I got it. I need to use the global facet positions and normals AND also need to negate the normals. What am I missing?

1 Like

I tried the righthanded system to true, but it didn’t change the normals issue. One solution is as above (use world position and world-negated normals). I wonder why is negating normals necessary?

Yes, you need the world space info or you assume that you work in Local space and in this case simply parent the line system to your mesh:

1 Like