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里面。

场景就添加进来了。

相关推荐
三条猫9 小时前
将3D CAD 模型结构树转换为图结构,用于训练CAD AI的思路
人工智能·3d·ai·cad·模型训练·图结构·结构树
二川bro14 小时前
第59节:常见问题汇编 - 60个典型问题解答
javascript·3d·threejs
摄影图1 天前
显示器办公桌面图片素材推荐:从杂乱到有序的桌面美学灵感
贴图
zhangfeng11331 天前
aigc 从2d 到 3d的形式转变,李飞飞在介绍WorldLabs的Marble平台,会围绕“空间智能“的核心理念,自动驾驶就是2d形式
3d·自动驾驶·aigc
da_vinci_x2 天前
PS 3D Viewer (Beta):概念美术的降维打击,白模直接在PS里转光打影出5张大片
人工智能·游戏·3d·prompt·aigc·材质·游戏美术
GISer_Jing2 天前
3D Cesium渲染架剖析
javascript·3d·webgl
背影疾风2 天前
基于深度学习的3D点云特征提取方法梳理
人工智能·深度学习·3d·自动驾驶
逻辑羊驼2 天前
Hunyuan3D本地部署
3d
众趣科技4 天前
众趣科技:以空间数字孪生技术重构VR内容制作新生态
3d·vr·空间计算