Textures on the pixel model

I am trying to load the official siggraph pixel model in three js, I load the obj and mtl file but the texture are not mapped correctly. I was wondering if I could get some direction on what the possible issue could be. I get the textures, but they are not correctly mapped, since this is a model I downloaded from https://s2019.siggraph.org/3d-model-portal/ , I am inclined to believe that the texture coordinates are not the problem.

Here is my code :-

  var manager = new THREE.LoadingManager();
     manager.addHandler( /\.dds$/i, new THREE.TGALoader() );
     var mtlload = new THREE.MTLLoader( manager )
     					.setPath( '/obj/Pixel/Pixel/' )
     					.setMaterialOptions(invertTrProperty = true)
     					.load( 'Pixel2.mtl', function ( materials ) {
     						new THREE.OBJLoader( manager )
     							.setMaterials( materials )
     							.setPath( '/obj/Pixel/Pixel/' )
     							.load( 'Pixel2.obj', function ( object ) {
     								object.scale.set(0.5, 0.5, 0.5);
     								object.position.y = 0.0;
     								scene.add( object );
     							}, onProgress, onError ); 
     					} );

Maybe you need to change this line to:

manager.addHandler( /\.tga$/i, new THREE.TGALoader() );
1 Like

Thank you for the answer! That was indeed a correction I had to make, it now loads the materials properly, but the texture still gets mapped incorrectly, I am wondering if this is because the threejs obj loader does not read the vertices and texture coordinates in the same order as in the obj file.

I just understood that the texture coordinates were indeed the problem. Using the fbx version of the model instead of the obj solves the problem. Thanks for hearing me out!

1 Like