Three.js: FBXLoader: Wrong Normal Data for lighting

Created on 31 Jan 2018  Â·  6Comments  Â·  Source: mrdoob/three.js

Description of the problem

I update the FBXLoader today and find that it show wrong normal (I guess is the normal) when lighting for some fbx model. I will show different view for the same scene in the following, note that I have set the intensity of the directional light to 1000 ( I think big enough ). However, it shows wrong effect.

image
image
image
image

It show in r87 like (the sun icon is a directional light):

image

and in r89:

image

In addition, reversely in r87, the FBXLoader also has some bugs (the icon in the scene is a rectarea light):

image

which show in r89:

image

So I think when fix some bug in r89, it maybe leads to the oppositive bug.

Three.js version
  • [x] Dev
  • [x] r89
  • [ ] ...
Browser
  • [x] All of them
  • [ ] Chrome
  • [ ] Firefox
  • [ ] Internet Explorer
OS
  • [x] All of them
  • [ ] Windows
  • [ ] macOS
  • [ ] Linux
  • [ ] Android
  • [ ] iOS
Hardware Requirements (graphics card, VR Device, ...)
Bug

Most helpful comment

note that I have set the intensity of the directional light to 1000 ( I think big enough )

1 is big enough. That is a clear sign the normals are not correct.

In r.88 the normals appear correct, and the model is loaded on its side.

screen shot 2018-02-01 at 10 45 20 am

In r.89, the normals are not correct, and the model is loaded right-side-up.

screen shot 2018-02-01 at 10 47 05 am

All 6 comments

Can you share the models? I'll take a look

testModel.zip

These are the model that result the problem. I just simplify the two model. Which show wrong in the website editor is the "testSofa1.fbx", and the "testIron.fbx" is which show wrong in r87.

testIron.fbx looks fine.

testSofa.fbx is missing textures so it appears black. Can you provide the textures as well?

What I get is just this model without textures. So it's neccessary for the model have the textures? But in r87, it show right. The following two picture have the same light direction, but they show different. I don't think it's about the texture. I try a lot in r89 and guess that the angle between what in r89 and the realistic light, has a bias of 90 degree.

r87:

image

r89:

image

After about 90 degree rotate, it show like in r87
image

Which show in the website editor use "testSofa1":

image
image

note that I have set the intensity of the directional light to 1000 ( I think big enough )

1 is big enough. That is a clear sign the normals are not correct.

In r.88 the normals appear correct, and the model is loaded on its side.

screen shot 2018-02-01 at 10 45 20 am

In r.89, the normals are not correct, and the model is loaded right-side-up.

screen shot 2018-02-01 at 10 47 05 am

This issue is that I applied the pre transform to the vertices, but not to the vertex normals. Kind of obvious that I would need to do that in hindsight...

Fixed in #13290

Was this page helpful?
0 / 5 - 0 ratings

Related issues

makc picture makc  Â·  3Comments

scrubs picture scrubs  Â·  3Comments

fuzihaofzh picture fuzihaofzh  Â·  3Comments

boyravikumar picture boyravikumar  Â·  3Comments

jlaquinte picture jlaquinte  Â·  3Comments