Three.js LineBasicMaterial 线宽问题

3

当我使用CanvasRendereer时,LineBasicMaterial的线宽度工作得很好,但当我切换到WebGL时,它就不起作用了,只有材质中的默认线宽度被应用。我发现了一些关于这个问题的帖子,并且我得到一个想法,即在Windows上由于ANGLE问题而无法工作。

这个问题还存在吗?

如果这个问题已经解决了,那么如何使用它,如果没有解决,那么是否有其他方法在WebGL中实现线宽度?

谢谢。


问题就在那里,如果我没记错的话,它很可能不会改变。标准的解决方法是使用看起来像宽线的矩形。 - Brendan Annable
1
请查看以下网址:http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/,http://threejs.org/examples/webgl_materials_wireframe.html和http://stackoverflow.com/questions/30632159/three-js-wireframe-model-from-vtk-file。 - WestLangley
问题仍然存在,因为Direct3D不支持线宽。 - gaitat
@gaitat 是的,你说得对。当我使用CanvasRenderer时,linewidth函数可以正常工作,但是当我切换到WebGL时,它就不能正常工作了。我需要在WebGL中工作。 - Shiladittya Chakraborty
1
请查看 http://www.lab4games.net/zz85/blog/2014/09/08/rendering-lines-and-bezier-curves-in-three-js-and-webgl/。该文章链接到以下示例:http://jabtunes.com/labs/3d/vector/tests/test_lines4.html。 - WestLangley
显示剩余8条评论
1个回答

1

WebGL不支持Three.js的线宽设置。

请参考https://threejs.org/docs/index.html#api/geometries/TubeGeometry

在Windows平台上,WebGL渲染器的线宽始终为1,无论设置的值为何。

您可以使用TubeGeometry。

https://github.com/jjcc1421/Three3DExtras

var line=new three3DExtras.tubeLine([-1,-1,0],[1,1,0],0.02,'#FFF');
var line2=new three3DExtras.tubeLine([-1,0,0],[1,0,0],0.02,'#E3DC1C');
var line3=new three3DExtras.tubeLine([-1,0,1],[1,0,1],0.02,'#B02735');
scene.add(line.getObject3D());
scene.add(line2.getObject3D());
scene.add(line3.getObject3D());

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接