似乎无法制作功能性 THREE.js collada 加载器

发布于 2024-12-18 12:06:49 字数 858 浏览 2 评论 0原文

我在获取没有内置相机或灯光渲染的定制 collada 对象时遇到问题。我或多或少复制了我在一些 collada 示例中看到的内容来创建我自己的加载器,如下所示:

var loader = new THREE.ColladaLoader();
var room, scene, stats;
loader.load('../Models/Rooms/boot.dae', function colladaReady( collada ){
    collada.scene.getChildByName('Cube',true).doubleSided = true;
    room = collada.scene;
    room.scale.x = room.scale.y = room.scale.z = 1;
    room.updateMatrix();
    init();
});

init 函数相当基本,看起来像这样

scene = new THREE.Scene();
scene.add( room );
scene.add( camera );
renderer.render(scene, camera);

这里是我尝试渲染的实际对象。我还尝试了示例文件夹中的 monster.dae 文件,但没有成功。 Chrome javascript 控制台没有显示任何错误,所以我不太确定在哪里查看代码。这一切都类似于功能性示例,所以我不确定为什么它不起作用。有什么我不知道的与 collada 加载相关的东西吗?

I'm having issues getting a custom made collada object with no built in camera or lighting to render. I more or less copied what I had seen in a few collada examples to create my own loader, which looks like this:

var loader = new THREE.ColladaLoader();
var room, scene, stats;
loader.load('../Models/Rooms/boot.dae', function colladaReady( collada ){
    collada.scene.getChildByName('Cube',true).doubleSided = true;
    room = collada.scene;
    room.scale.x = room.scale.y = room.scale.z = 1;
    room.updateMatrix();
    init();
});

The init function is fairly basic and looks like this

scene = new THREE.Scene();
scene.add( room );
scene.add( camera );
renderer.render(scene, camera);

Here is the actual object I'm trying to render. I have also tried it out with the monster.dae file that is in the examples folder without success. The Chrome javascript console isn't showing any errors, so I'm not quite sure where to look in my code. It all resembles functional examples, so I'm not sure why it's not functional. Is there something I'm unaware of that is relevant to collada loading?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间你老了 2024-12-25 12:06:49

已解决:该项目正在渲染,但没有与之关联的皮肤或纹理。因此它以与背景相同的颜色进行渲染,可以理解的是,它看起来根本没有渲染。通过在地面上添加网格只是为了检查而发现的。

RESOLVED: The item was rendering, but had no skin or texture associated with it. So it was rendering at the same colour as the background, which understandably appears to not be rendering at all. Discovered by adding a grid to the ground just to check.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文