在 JavaScript/HTML5 中显示 3D 模型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11350090/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 05:35:25  来源:igfitidea点击:

Displaying a 3D model in JavaScript/HTML5

javascripthtml3dwebgl

提问by Goro

I am looking at rendering a 3D model in a browser. What tools should I use/what places should I look at?

我正在考虑在浏览器中渲染 3D 模型。我应该使用哪些工具/应该查看哪些地方?

I don't know what data format the model will be, I can likely request that data to formatted in any way I want.

我不知道模型将采用什么数据格式,我可能会要求以我想要的任何方式格式化该数据。

I am looking at three.jsbut it seems that it needs WebGL to work, which appears to be unsupported in IE.

我在看three.js,但它似乎需要WebGL才能工作,这在IE中似乎不受支持。

Does a "cross-browser compatible HTML 3d rendering engine" exists? :)

是否存在“跨浏览器兼容的 HTML 3d 渲染引擎”?:)

采纳答案by Etienne Dupuis

I have not played with 3D yet, but I know a good place for ressources on 3D for HTML5.

我还没有玩过 3D,但我知道一个关于 3D 的 HTML5 资源的好地方。

http://www.html5rocks.com/en/gaming

http://www.html5rocks.com/en/gaming

And here is a tutorial on how to create your 3D models with the Three.jsFramework.

这是关于如何使用Three.js框架创建 3D 模型的教程。

http://www.html5rocks.com/en/tutorials/three/intro/

http://www.html5rocks.com/en/tutorials/three/intro/

This may help you. Good luck.

这可能对你有帮助。祝你好运。

回答by frabonomi

I also needed what you've been searching for and did some research.

我还需要你一直在寻找的东西并做了一些研究。

I found JSC3D(https://code.google.com/p/jsc3d/). It's a project written entirely in Javascript and uses the HTML canvas. It has been tested for Opera, Chrome, Firefox, Safari, IE9 and more.

我找到了JSC3D( https://code.google.com/p/jsc3d/)。这是一个完全用 Javascript 编写并使用 HTML 画布的项目。它已针对 Opera、Chrome、Firefox、Safari、IE9 等进行了测试。

Then you have services as p3d.inand Sketchfabthat give you a nice reader to view 3D models on a web page: they use HTML5 and WebGL. They both have a free version.

然后您有p3d.inSketchfab等服务,它们为您提供了一个很好的阅读器,可以在网页上查看 3D 模型:它们使用 HTML5 和 WebGL。他们都有免费版本。

回答by Jochen

do you work with a 3d tool such as maya? for maya you can look at http://www.inka3d.com

您是否使用 3d 工具(例如 Maya)?对于玛雅,您可以查看http://www.inka3d.com

回答by user3325025

a couple years down the road, I'd vote for three.js because

几年后,我会投票给three.js,因为

ie 11 supports webgl (to what extent I can't assure you since i'm usually in chrome)

即 11 支持 webgl(我无法向你保证到什么程度,因为我通常使用 chrome)

and, as far as importing external models into three.js, here's a link to mrdoob's updated loaders (so many!)

并且,就将外部模型导入到three.js 而言,这里有一个指向mrdoob 更新加载器的链接(太多了!)

UPDATE nov 2019: the THREE.js loaders are now far more and it makes little sense to post them all: just go to this link

2019 年 11 月更新:THREE.js 加载器现在更多,将它们全部发布毫无意义:只需转到此链接

http://threejs.org/examplesand review the loaders - at least 20 of them

http://threejs.org/examples并查看加载程序 - 至少 20 个