Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

169
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda