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

358
Vistas
How can I position/scale a displacement map on a model in three.js?

I would like to apply an image as a displacement map on a 3D model, but position and scale the displacement image so that it is applied to a specific part of the UV map.

I have achieved this in Blender using texture coordinates like so: blender displacement map. My understanding is that this position is based off the UV map, which you can see here. The highlighted orange section is where I need to apply the displacement.

The end result I am after is having users draw a design in html canvas, and apply that design to the model as an 'engraving'. See example of the app.

This is how my code looks at the moment

const ModelWrapper: React.FC<ModelProps> = ({
  shape,
  variant,
  material,
  engraving,
}) => {
  const group = useRef<THREE.Group>(null);
  const { nodes } = useGLTF(variant.modelUrl) as unknown as GLTFResult;

  const selectedMaterial = useMemo(() => {
    const displacementMap = new THREE.TextureLoader().load(engraving.imageUrl);
    displacementMap.flipY = false;
    return new THREE.MeshStandardMaterial({
      color: material.baseColor ?? '#ffffbb',
      roughness: Number(material.roughness) ?? 0.01,
      metalness: Number(material.metallic) ?? 1,
      displacementMap: displacementMap,
      displacementScale: -0.0002,
    });
  }, [material, engraving]);

  return (
    <group ref={group} dispose={null}>
      <mesh geometry={nodes[shape.name].geometry}>
        <meshStandardMaterial
          color={selectedMaterial.color}
          roughness={selectedMaterial.roughness}
          metalness={selectedMaterial.metalness}
          displacementMap={selectedMaterial.displacementMap}
          displacementScale={selectedMaterial.displacementScale}
        />
      </mesh>
    </group>
  );
};
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