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

121
Visualizações
GTLF Loader in react-three/fiber doesnt load textures

I use react-thee/fiber 7.0.0 and I have GLTF file with a bin file. When I look at my model in gltf-viewer.donmccurdy.com - I can see all metallic materials and transparent glass. But when I add it on canvas I can see black color instead of metallic and no transparency with glass parts ((

Thats how i load model:

const loader = new GLTFLoader();
loader.load(modelUrl, function(obj) {setScene(obj.scene)}

Thats how my Canvas props looks:

camera={{position: [3, 2, -3], enablePan: true}}
colorManagement={true}
shadows={true}
onCreated={({ gl }) => {
  gl.outputEncoding = sRGBEncoding;
  gl.physicallyCorrectLights = true;
  gl.shadowMap.enabled = true;
  gl.shadowMap.type = PCFSoftShadowMap;
 }}

Help!!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

these materials need light. without light they appear black. the online gltf viewer you're trying adds some lights by default.

you don't need to load models like that, and if you execute that in the render functions that's a mistake.

import { useGLTF } from '@react-three/drei'

function Model() {
  const { scene } = useGLTF(url)
  return <primtive object={scene} />

this hook takes care of everything, it can even handle gltfs compressed with draco or meshopt without you having to do a thing.

the camera does not have a enablePan property. canvas managed colors by default, "colorManagement" doesn't exist as a prop. you dont need to switch to srgb, it's default. you can enable shadows with a quick prop. basically do this:

<Canvas shadows camera={{ position: [3, 2, -3] }} />

last but not least, compress your file into a glb. you can also look into gltfjsx which is perfect for models in react. it also has a transform option which compresses and dedupes.

about 4 years ago · Juan Pablo Isaza Relatório
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