Setting of Min and MagFilter

Dear all :slight_smile:
I try to set Min and Mag Filter, However it seems fail…it does not work.
Code is as follow…

Should I set it in “materials” or “mtlLoader” ? thank you

const mtlLoader = new MTLLoader(loadingManager);

mtlLoader.minFilter = THREE.NearestFilter;
mtlLoader.magFilter = THREE.LinearFilter;

mtlLoader.load(Path_String+'.mtl', (mtlParseResult) => {
  const objLoader = new OBJLoader2(loadingManager);
  const materials =  MtlObjBridge.addMaterialsFromMtlLoader(mtlParseResult);

  //materials.minFilter = THREE.NearestFilter;
  //materials.magFilter = THREE.LinearFilter;

  objLoader.addMaterials(materials);
  objLoader.load(Path_String+'.obj', (root) => {

You can’t apply texture filtering settings on a loader. It also does not work with materials. You have to work with an instance of THREE.Texture instead.

Thank yo so much.
Would you please tell me how to modify my code ? Because it seems there is no three.texture and I don’t know how fix it , thank you

Try it with this code in the onLoad() callback of OBJLoader:

root.traverse( function( object ) {

    if ( object.isMesh && object.material.map ) {

        object.material.map.minFilter = THREE.NearestFilter;
        object.material.map.magFilter = THREE.LinearFilter;

    }

} );

Thank you so much I have put your nice code in my code as follow…
is this correct ?
I feel so sorry because I am just a beginner … thank you so much


  objLoader.addMaterials(materials);
  objLoader.load(Path_String+'.obj', (root) => {

  /////Sharpen
  root.traverse(function(object) {
    if(object.isMesh && object.material.map) {
        object.material.map.minFilter = THREE.NearestFilter;
        object.material.map.magFilter = THREE.LinearFilter;
    }
  });
  /////

    scene.add(root);