在三 - drei中的SA模型时,环境可能不会呈现

发布于 2025-02-08 04:29:50 字数 1392 浏览 3 评论 0原文

那就是我如何渲染我的环境的

const Three = () => {
  return (
    <>
        <PerspectiveCamera makeDefault position={[0,3,10]} />
        <OrbitControls  />
        <directionalLight args={[0xffffff, .5]} position={[-5,20,0]} castShadow />
        <spotLight args={[0xffffff]} position={[0,10,0]} castShadow />

        <Model scale={0.5} />
      
        <Environment background>
          <mesh scale={100}>
            <sphereGeometry args={[1, 64, 64]} />
            <meshBasicMaterial  side={THREE.BackSide} />
          </mesh>
        </Environment>


    </>
  )
}

export default Three  

function App() {
  return (
    <div>
      <Canvas 
      style={{height:'100vh',backgroundColor:'transparent'}}
      shadows
      >
        <Three />
        
      </Canvas>
    </div>
  )
}

export default App

方式

在保存vite时更改状态或正常刷新后的输出

PS:删除模型时,环境正常 我尝试使用不同的压缩,不同的模型仍然存在相同的问题,有人知道是什么原因引起了问题吗?

thats how i render my environment

const Three = () => {
  return (
    <>
        <PerspectiveCamera makeDefault position={[0,3,10]} />
        <OrbitControls  />
        <directionalLight args={[0xffffff, .5]} position={[-5,20,0]} castShadow />
        <spotLight args={[0xffffff]} position={[0,10,0]} castShadow />

        <Model scale={0.5} />
      
        <Environment background>
          <mesh scale={100}>
            <sphereGeometry args={[1, 64, 64]} />
            <meshBasicMaterial  side={THREE.BackSide} />
          </mesh>
        </Environment>


    </>
  )
}

export default Three  

thats my app.js

function App() {
  return (
    <div>
      <Canvas 
      style={{height:'100vh',backgroundColor:'transparent'}}
      shadows
      >
        <Three />
        
      </Canvas>
    </div>
  )
}

export default App

the output after hard refresh
enter image description here

the output after changing a state or normal refresh when saving in vite
enter image description here

ps : the environment works fine when i remove the model
i tried to use different compression , different models i still have the same issue do anyone know what is causing the issue ?!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文