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

365
Visualizações
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 à 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