OBJ Loading : set upward normal when file has no normals

Hi,

I was testing some random assets with Babylon and came accross this, not sure if it is really an issue.
The file loaded in the following playground is an OBJ that only have vertices and faces describes in the file, no normals are written.

By default, Babylon will fill the normals with an Upward vector Vector3.Up()
Done in the solidParser.ts file
There is an option on the loader to re-compute the normals OBJFileLoader.COMPUTE_NORMALS = true; even if there are already set. I don’t really want to do this to not “break” normals that would have been done by the author of the model.

By doing this, it make very difficult to light/texture this type of mesh.

I was wandering if there is any reason it is done this way and if there should be an option to compute normals only if the file do not have normal setted ?

Blender seems to do this by default (compute them if they do not exist).

I would think it is a bug and by default if all normals are up they should be discarded which would let shaders rely on derivatives to create them.

cc @ryantrem and @alexchuber any other ideas ? concerns ?

This seems like a bug to me as well :slight_smile: If no normals are defined in an obj, I’d expect the normals to be computed, not hardcoded to Vector3.Up().

2 Likes

@alexchuber, you want to have a look ?

Yup! Planning on getting to this later today.

2 Likes
1 Like