使用Threejs进行STL渲染 [英] STL rendering with threejs

查看:984
本文介绍了使用Threejs进行STL渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个3D模型,用于以3D方式打印工业布局. 因为我不习惯使用专业的3D建模器软件,所以我使用了SketchUp,结果很好!

现在,我想重用3D模型来动态访问待定"安装.

我以Collada格式(DAE)导出了每个对象,然后尝试在Threejs中使用collada导入器. 我希望可以交互式选择约130个对象,但是我只能加载一个对象...

然后尝试使用STL加载器(在使用MESHLAB将对象从DAE转换为STL之后).

然后它可以正常工作,但是呈现问题.

在链接的图片中(抱歉,信誉不佳!),即使没有设置该属性,您也可以看到对象的某些部分看起来是透明的"! (只有地面).

在使用TrackBallControl进行移动时,对象的某些部分会不时消失....

我只尝试一个物体,有或没有地面,...

我快照了所遇到的问题:

  • 图1,红色圆圈内,出现错误
  • 图2,没有地面,它是一样的:应该隐藏的某些部分不是
  • 图3,线框渲染在导出的模型中未显示pb ...

链接>> http://stackoverflow.legrandcondor.com/photo.html

链接>> http://stackoverflow.legrandcondor.com/

有什么想法吗?我发疯之前的建议?! (一切正常!)

预先感谢

解决方案

您的相机近平面为0.1,远平面为1000000.近平面的较小值会导致深度分类精度问题.

根据您的情况,将您的近平面设置为100.

ref: http://www.opengl.org/wiki/Depth_Buffer_Precision

还可以考虑使用OrbitControls,这样您的模型就可以保持正面朝上.

three.js r.69

I have created a 3D model for printing in 3D an industrial layout. Because I am not used in playing with professional 3D modeler software, I used SketchUp and the result was fine !

Now, I want to reuse the 3D models to make a dynamic visit of the "to-be" installation.

I exported each object in Collada format (DAE), and then try to used the collada importer in Threejs. I have around 130 objects that I want to be able to select interactively, but I manage only to load one ...

I then get a try with STL loader (after having converting objects with MESHLAB from DAE to STL).

And then it works without any problem... but rendering problems.

In the linked picture (sorry, not enough reputation to insert image !), you can see that some parts of the objects seem the be "transparency", even if they have not this property set ! (only the ground is).

While moving with the TrackBallControl, some parts of the objects disappear from time to time....

I try with only one object, with or without the ground,...

I took snapshots of the problem I get :

  • fig 1, inside the red circle, the errors appears
  • fig 2, without the ground, it is the same : some parts that should be hidden are not
  • fig 3, the wireframe rendering shows not pb in the exported model...

link >> http://stackoverflow.legrandcondor.com/photo.html

link >> http://stackoverflow.legrandcondor.com/

Any ideas ? Suggestions before I get crazy ?! (Everything else works fine!)

Thankx in advance,

解决方案

Your camera near plane is 0.1 and far plane is 1000000. Small values of the near plane can lead to depth-sorting precision problems.

In your case, set your near plane to, say, 100.

ref: http://www.opengl.org/wiki/Depth_Buffer_Precision

Also consider using OrbitControls so your model remains right-side-up.

three.js r.69

这篇关于使用Threejs进行STL渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆