Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda