OBJ loader - Computed normals are wrong if OPTIMIZE_WITH_UV is set to true

Hi all,
I am trying to import an OBJ into my scene with the COMPUTE_NORMALS setting turned on. However, if I also have the OPTIMIZE_WITH_UV setting turned on, the normals split apart at the edges of the UV shells and cause a sharp line to appear. Unfortunately, it is necessary to have both of these settings turned on for my application: the OBJs I’m loading are generated dynamically and do not have normal values precomputed. And unless I turn on OPTIMIZE_WITH_UV, the UV layout get messed up and textures don’t get placed correctly (this fix is suggested in the documentation).

This playground shows the issue:

The mesh on top is the one with the problem, you can see the sharp line down the middle. The mesh below is imported with OPTIMIZE_WITH_UV turned off and the normals as expected. Anyone have any idea what’s going on? Thanks!

This PR will add a new OPTIMIZE_NORMALS option that will help with your problem:

In the meantime, you can use this PG:

2 Likes

Awesome, thanks!