问题标签 [gltf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
905 浏览

javascript - 如何在javascript中获取gltf模型的屏幕截图?

我正在使用 AR.js 和 React 制作 AR Web 应用程序。它使用 A-Frame 组件渲染 3D 模型<a-gltf-model>,因为 AR.js 与 A-Frame 相关。

我想做一个功能来将最喜欢的 3D 保存models(gltf models)为屏幕截图。

如何在javascript中获取gltf模型的屏幕截图?

0 投票
1 回答
2282 浏览

three.js - Blender gltf 导出器模型是黑暗的

我有一个 .OBJ 模型,我导入 Blender (2.79) 并尝试使用以下导出器导出到 .gtlf - https://github.com/KhronosGroup/glTF-Blender-Exporter

这是模型 -模型

这是我在 Blender 中的导出设置

在此处输入图像描述

当我在 Blender 的纹理模式下查看模型时,模型看起来很亮并且有纹理,但导出的 gltf 模型在 a 帧中看起来很暗。

这是它在搅拌机中的样子 在此处输入图像描述

这就是在 aframe 中导出后在 gltf 中的样子

在此处输入图像描述

我已经尝试了很多导出设置的组合,并在 a-frame 中使用了照明,但无法让 aframe 中的模型看起来像 Blender 中的模型。

如果有人可以提供帮助,我将不胜感激。

0 投票
1 回答
2387 浏览

javascript - 如何在three.js中加载gLTF

我正在尝试使用 three.js 上传 gLTF 文件,但它对我不起作用。我遇到了一些错误,我通过一些研究修复了这些错误,但我仍然有黑屏。修复之一是将其添加到我的 chrome 目标目录

这解决了我的问题但是当我打开控制台时我仍然得到这个 在此处输入图像描述

有人能帮我吗?我只是想用three.js在屏幕上显示“DamagedHelmet.gltf”文件

有时错误会回来,这就是它看起来像 在此处输入图像描述 JS 代码

0 投票
0 回答
312 浏览

animation - Sketchup to Blender to Animated GLTF into Cesium nightmare

I would be grateful for some suggestions for best best practice.

I am a proficient user of Sketchup for a dozen years. I can make my way around blender.

I have a need to model a wind turbine which ends up in gltf and imported into cesium with animated blades and orientation (ie. two animations).

Over the last couple of weeks I have learnt how to animate the blades in the correct plane in blender at appropriate revolution speed. I now have an animated model ready for export with seemingly good structure / hierarchy of parts.

If I export to fbx the blade rotation is correct but materials and textures are missing. Plus I can't migrate it to Gltf as every option I try fails.

If I use the gltf exporters from Khronos when running the animation the blades disappear altogether. If I use the other gltf exporter the blade angle gets corrupted (unlike fbx) and no animation survives the export. If I import the fbx back into blender the model is intact (except no materials) and the rotation works as exported. If I export as Collada / dae the blades drop from the top of the model to the bottom and there is no animation.

I have played hours of videos, searched and read endless Web pages but after weeks of effort I have failed to get anywhere near my goal - an animated gltf that I can import into Cesium.

Every step of the way is plagued by imponderable next steps to fix the problem. I have run out of puff.

I would be hugely grateful for some best case suggestions on doing something which seems like it should be simple but simply isn't.

Regards

dawrightau

0 投票
1 回答
1220 浏览

three.js - 更新三点几何的最佳方法

我有一个搅拌机模型,上面有一些形状键。我导出这个模型并在threejs中使用它。可以说这是一个立方体。然后我创建了 Three.Points,在这个模型(即立方体)的顶点上绘制小球体。

现在使用 morphTargets,我为立方体设置了动画。到目前为止,一切都很好。

但我期待这些点也会变形/动画,因为这些点使用相同的几何图形。但似乎不能开箱即用。

一些谷歌搜索表明,变形发生在 GPU 级别,并且对象中的几何数据并未真正修改。在 StackOverflow 的其中一个问题(Three.js: Get updated vertices with morph targets)中,@WestLangley 建议在 CPU 上进行相同的几何更新,然后使用它。

我的问题:

  1. 在解决这个问题时还有其他选择吗?
  2. CPU 变形计算似乎更慢,我想看看是否有任何其他方法可以让我的 Three.Points 与变形立方体保持同步?立方体用 morphtargets 动画,我期待 Three.Points 做同样的事情。

如果搅拌机中的形状键动画涉及更多,我想#1不是一个真正的选择?

理想情况下,以下内容会有所帮助:

0 投票
0 回答
1028 浏览

javascript - 未捕获的类型错误:无法读取 GLTFLoader.load 处未定义的属性“extractUrlBase”

我正在使用 Potree 中的这个示例,链接如下: 1 我正在尝试添加这个名为“DamagedHelmet.gltf”的新 GLTF 文件,而不是原始示例中名为“stanford_bunny_reduced.obj”的目标文件,但我'收到此错误:

未捕获的类型错误:无法读取 GLTFLoader.load 处未定义的属性“extractUrlBase”

添加了目标文件所在的 gltf 文件,我还导入了 OBJLoder.js 所在的 GLTFLoader.js 文件。我不确定如何解决这个错误。

0 投票
0 回答
533 浏览

three.js - GLTFLoader 不提供 SkinnedMesh 中几何体的属性“骨骼”

我正在使用从 Blender 到 Three.js 的导出和加载功能。我目前正在从 json 转移到 gltf2 这样做。但是使用 gltf 导出/加载有 Geometry.skeleton.bones 但 Geometry.bones 不再填充。我寻求帮助,他们如何从骷髅中恢复?

0 投票
1 回答
438 浏览

node.js - aframe 看不到嵌入 .gltf 场景-- 404 未找到。(通过node.js)

aframe 没有看到在“a-gltf-model”中嵌入 .gltf 场景——404 未找到。(通过node.js)。但是,如果我将 src 放入“a-emity” - 场景在页面上某处的彩虹上,宽度/高度为 0/0。位置没有帮助。入门场景(内联)很好。

所以,我在根目录中有两个文件,第一个是'index.js':



而且,这里是 'index.html' 的内容:



ps sry,我才刚刚开始,这是测试任务,我之前正在使用 Blender。原图在这里

0 投票
1 回答
1431 浏览

html - 如何将glTF文件放在aframe中?

我只是想将 Sketchfab 中的 3d 模型添加到这个场景中,但我找不到任何关于如何做到这一点的简单教程。这是代码:

这是我要上传的sketchfab模型:https ://sketchfab.com/models/729e5bc464454b5099445538e7785a19#

0 投票
2 回答
1361 浏览

three.js - 更正 Three.js 中导入的 Cesium GLTF/GLB 文件的旋转

我在波士顿有一套 Cesium 3D 瓷砖建筑。这是一个示例图块:model.glb。当我使用 THREE.GLTFLoader 将此图块导入 Three.js 时,模型相对于 XZ 平面旋转。通过反复试验,我发现我可以通过如下旋转模型来拉直模型:

我怀疑这种旋转是由于 Cesiuim 默认使用地球固定框架轴 (ITRF)。如何在 Three.js 中自动反转这种旋转(而不是通过反复试验手动进行)?

这是我手动旋转模型之前的模型截图:

手动旋转前的模型

这是我手动旋转模型后的屏幕截图:

手动旋转后的模型

以下是与 Cesium 3D 瓦片相关的地理空间信息: