Upon loading the Wavefront obj file from this link, I noticed that the normals were not calculated correctly, resulting in incorrect shading of the model. The code used to load the *.obj model was based on a modified version of the original project's loader / obj example. In such cases, after applying transformations like scaling to the model, it is usually necessary to call functions like dirtyDisplayList
, UpdateModel
, or RecalculateNormals
to sync the model with the changes made. In Three.js, common functions for this purpose are geometry.computeFaceNormals()
and
geometry.computeVertexNormals( true )
.
However, when I tried calling geometry.computeFaceNormals()
and
geometry.computeVertexNormals( true )
, the model disappeared completely, accompanied by a console error message: TypeError: geometry.computeFaceNormals is not a function OBJ_Loader.html:102.
I am unsure what mistake I am making here. Any insights on this issue would be greatly appreciated.
var I_prof = new THREE.OBJLoader();
I_prof.load('obj/male02/new_I_Profile.obj', function(geometry){
geometry.scale.set(10, 10, 10);
geometry.rotation.x = 3.1415/2;
geometry.position.z = -0;
geometry.position.x = 0;
geometry.position.y =0;
//geometry.computeFaceNormals();
//geometry.computeVertexNormals( true );
scene.add(geometry);
} );