GLB exporter Face Direction inverted

Hi,
I see, that the face orientation in an exported mesh are reversed.
We can change culling in the material, but still the orientation of the mesh is inverted.

As I understood it is the coordinate system translation.
How would I be able to change that?

Best. Werner

Hello,

I you want to change orientation for one material only, it’s the material.sideOrientation = 0; (or 1 … clockwise VS counter clockwise)


If you want to change for the whole scene, it’s scene.useRightHandedSystem = true (or false)


By the way, a few weeks ago I added a new feature to the Playground :

When you edit a param (A, the one we are talking about) you can copy the corresponding line of code (B)
Also, if you open the console, at soon as you are having a look at a node (in that case, the material), the object globalThis.debugNode is the material, so that you can directly interact with it within the console. That’s why the copy buttons will copy this string to the clipboard :
globalThis.debugNode.sideOrientation = 0;// (debugNode as BABYLON.StandardMaterial)

++
Tricotou

Thx,

We are exporting meshes from Babylon using the GLTF2 exporter.

Everything we try results in the wrong vertex, face normals in the mesh itself.

The display depends on the material settings, which comes with the glb file, which we can alter.

But the mesh itself does not react on all these options.
So it is always inverted.

Go to Edit mode.
Select all Faces (A).
Options / Turn on Faces oriention

Check the color of the faces on your mesh.

One face with flipped normals:

Hi Roland.

Thank you for your reply.

I am aware how to edit meshes and in fact that is the only option if you want to have the normals facing in the correct direction.

I prefer having the normals in the correct direction as ppl with no experience can download the model, so I want the model to be correct.

In fact its not really wrong, as the material will diplay it correctly, its just not a “clean” export, and I guess it should be possible?

Or is this in fact always flipped while doing the gltf export?

Best.
Werner

According to my very talented friend and Blender guru @krystof_klestil it might be due to negative scales used in your mesh/meshes.

1 Like

Hi.
I think he might me right. :wink:
The thing here is, that we somehow cannot get the export right.
So from our scene to the .glb file.
We have changed a lot in the source including flipping the meshes and/or also the parents.
I read about that there is a conversion of the coordinate system, then we also checked materials and the options.
We could make it work from babylon scene to .glb and by importing it again to babylon actual the sandbox, the vertex normals are displayed correctly.

Somehow when I import the model into Blender it basically is always the same result regarding the mesh, vertex and face normals are flipped, as well the face orientation (blender) are wrong - inside, red.
The display of the mesh depends on the material, shader settings in Blender.
We need to look into that deeper I fear as none of the options do seem to have an influence.
And/Or it might be a collision of parameters and we need to find the correct parameters.

Cheers,Werner

We had to reverse the vertex order, now its working!
Hurra
Werner

2 Likes

We could actually help you earlier if we knew about this :smiley: @Tricotou was actually navigating you in the right direction proposing you to change the orientation CW/CCW.

However I’m glad you solved it by yourself!

I tried the cw/ccw ordering of the scene which didnt help.
So we had to do it differently.

Yes yes. Glad to have a superior programmer here on the team :wink:

Best.
Werner

1 Like