Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
about threejs multi model and color picker

I'm working on loading multi-models with threejs and applying textures. But now, the multi-model is loaded with the code, but the texture is not applied to the loaded model, how do I fix it?

this is my github https://github.com/OKYOUNGBIN/Threejs_Web.git

please help me

function setMaterial(parent, type, mtl) {
    parent.traverse((shadow) => {
        if (shadow.isMesh && shadow.nameID != null) {
            if (shadow.nameID == type) {
                shadow.material = mtl;
            }
        }
    })
}

const loader = new GLTFLoader;

loader.load(MODEL_PATH1, function (Top) {
    console.log('success')
    console.log(Top)
    theModel = Top.scene;

    theModel.traverse((Top) => {
        if (Top.isMesh) {
            Top.castShadow = true;
            Top.receiveShadow = true;
        }
    });
    theModel.scale.set(3, 2, 2);
    theModel.position.y = -1;

    for (let object of INITIAL_MAP) {
        initColor(theModel, object.childID, object.mtl);
    }
    scene.add(theModel);
})

const INITIAL_MTL = new THREE.MeshPhongMaterial({ color: 0xf1f1f1, shininess: 10 });
const INITIAL_MAP = [
    { childID: "mesh_0", mtl: INITIAL_MTL },
    { childID: "mesh_0_1", mtl: INITIAL_MTL },
    { childID: "shelf_0301_t50_h600_w600_frame", mtl: INITIAL_MTL },
]

function initColor(parent, type, mtl) {
    parent.traverse((shadow) => {
        if (shadow.isMesh) {
            if (shadow.name.includes(type)) {
                shadow.material = mtl;
                shadow.nameID = type;
            }
        }
    })
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!