HariV
HariV

Reputation: 707

Texture and material loading issue with THREE.OBJLoader2.WWOBJLoader2

I am using three.js to include 3D models (OBJ + MTL format) in my web application. The size of the 3D models are very big( 35-70MB ), so i need to load them using a web worker in order to avoid freezing the web page. I have tried the web worker based method using THREE.OBJLoader2.WWOBJLoader2, but only one texture is getting applied to the 3D model. I have tried it using different 3D models and the result is same.

reader.addEventListener( 'load', function ( event ) {

    var uint8ArrayNew  = new Uint8Array(event.target.result);
    objBuffer = uint8ArrayNew;

    initPostGL();
    prepData = new THREE.OBJLoader2.WWOBJLoader2.PrepDataArrayBuffer(
        workerInput.obj,    // overall model name
        objBuffer,          // OBJ file as arrayBuffer
        workerInput.path,   // Texture path
        mtlString           // MTL as string
    );

    objectGroup = new THREE.Group();
    objectGroup.name = workerInput.obj;

    prepData.setSceneGraphBaseNode( objectGroup );
    prepData.setStreamMeshes( true );
    wwObjLoader2.setDebug(false);
    wwObjLoader2.prepareRun( prepData );
    wwObjLoader2.run();

}, false );
reader.readAsArrayBuffer( objectAsBuffer );

Here is the link to the OBJ file : https://www.dropbox.com/s/95l3cwv68a0r5hi/SampleObjMtlModel.zip?dl=0

rendering result (red circle shows the loaded texture)

Upvotes: 0

Views: 575

Answers (1)

HariV
HariV

Reputation: 707

The problem was with the THREE.OBJLoader2.WWOBJLoader2 library which is resolved now. For reference visit https://github.com/mrdoob/three.js/pull/11955

Upvotes: 1

Related Questions