gltf模型加载 与3d背景贴图

Poly Haveny

用于3d模型跟贴图下载资源

Sketchfab

里面有免费的模型

模型放到public里面

复制代码
const loader = new GLTFLoader()
      // 加载GLTF模型
      loader.load(
        '/scene.gltf',
        (gltf) => {
          // 将加载的模型添加到场景中
          scene.add(gltf.scene)
          // 现在你可以开始渲染循环了
          let angle = 0
          function animate() {
            requestAnimationFrame(animate)
            angle += 0.002
            gltf.scene.rotation.y = angle
            renderer.render(scene, camera)
          }
          animate()
        },
        // 可选:加载进度回调
        (xhr) => {
          console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
        },
        // 可选:加载错误回调
        (error) => {
          console.log('An error happened', error)
        }
      )

就加载进来了

之后加载背景图。

点击右边的jpg,右键将图像另存为,放到public里面。

场景就添加进来了。

相关推荐
小猴子爱上树11 小时前
跨境电商图片自动翻译实现方案
贴图
寒水馨17 小时前
macOS下载、安装godot-4.7.1-stable(附安装包Godot_v4.7.1-stable_macos.universal.zip)
macos·3d·游戏引擎·godot·跨平台·游戏开发·2d
人工智能培训20 小时前
AI如何学习知识?与人类学习的本质差异
大数据·网络·数据库·人工智能·学习·3d
3D小将2 天前
3D格式转换之Rhino(Rhinoceros)转 CATIA 标准化转换技术
3d·solidworks模型·ug模型·rhino模型·catia模型
爱吃程序猿的喵3 天前
LingBot-Map 复现与原理剖析:基于 Geometric Context Transformer 的流式 3D 重建
人工智能·python·深度学习·计算机视觉·3d·transformer
xcLeigh3 天前
Unity基础:创建你的第一个游戏物体——Cube、Sphere与基本3D物体
游戏·3d·unity·教程
蓝速科技3 天前
蓝速科技 3D 全息舱展览馆落地实测:降噪算力与成像质量深度评测
人工智能·科技·3d
fengbingchun4 天前
3D领域常用术语总结
3d
lialaka4 天前
「解忧暗室(SereneNook)」——全语音_3D_AI_具身交互智能数字人深夜陪伴与情绪自愈舱[1]
人工智能·3d·交互