You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React项目导入GLTF模型显示效果与GLTF Viewer不一致原因排查

问题:GLTF模型在React-Three-Fiber中材质显示异常

我在Cycles中制作了两个带有透明Shader的柱状模型,烘焙法线贴图后导出为.glb格式。该模型在GLTF Viewer中显示正常,但在我的React项目中使用@react-three/drei的useGLTF导入后,材质显示效果差异明显且较差。我已尝试调整灯光强度,但无效,怀疑是材质粗糙度相关问题。

以下是我的代码:

import React, { useRef } from 'react'
import { useGLTF, PerspectiveCamera } from '@react-three/drei'

export function Bars(props) {
  const { nodes, materials } = useGLTF('./src/assets/models/bars.glb')
  return (
    <group {...props} dispose={null}>
      <PerspectiveCamera makeDefault={false} far={1000} near={0.1} fov={22.895} position={[0, 1.36, 3.661]} />
      <pointLight intensity={50.0} decay={2} color="#fdf6ff" position={[0.38, 0, 0.18]} rotation={[Math.PI / 2, 0, 0]} />
      <pointLight intensity={50.0} decay={2} color="#fdf6ff" position={[0.699, 2.773, 0.118]} rotation={[-Math.PI / 2, 0, 0]} />
      <mesh geometry={nodes.bar1.geometry} material={materials['glow.001']} position={[0.36, 1.706, 0]} scale={[1, 1, 2.532]} />
      <mesh geometry={nodes.bar2.geometry} material={materials['glow.002']} position={[0.571, 0.86, 0]} scale={[1, 1, 2.532]} />
    </group>
  )
}

useGLTF.preload('./src/assets/models/bars.glb')

我还附上了烘焙法线贴图时的操作界面截图。作为新手,我需要相关帮助,感谢!


内容的提问来源于stack exchange,提问作者SOHAN C

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 14:56:07