Sean-Bradley / objVertexColors

Three.js obj loader with vertex color support
https://sean-bradley.github.io/objVertexColors/
11 stars 4 forks source link

Can't use the lighting method on the mesh #2

Open fankunyang opened 6 years ago

fankunyang commented 6 years ago

Hi Sean,

I try to use the THREE.SpotLight and THREE.PointLight lighting effects on the mesh loaded by OBJVertexColorLoader. And can't see any lighting on the mesh. Then I modified the file "OBJVertexColorLoader.js" and change the material from "THREE.MeshBasicMaterial" to "THREE.MeshStandardMaterial". It only works on the "THREE.AmbientLight" lighting method. How can I change the file "OBJVertexColorLoader.js" to enable the lighting methods (ex: SpotLight) can work on loading mesh?

Thank you.

Best regard,

Sean-Bradley commented 6 years ago

It may be that the mesh your are using needs the face or vertex normals recalculated. Are you using my cat mesh, or your own?

fankunyang commented 6 years ago

Hi Sean,

Thanks for your response. I used the sample "emmy3d_1.obj" and the same result happened. I found a way to solve it: add the function "geometry.computeVertexNormals();"

Best regard,