admin管理员组文章数量:1418400
lineMat = new THREE.LineBasicMaterial({color, linewidth: 5});
doesn't work.
I need a simple method for 3D (rotating scene): drawLine(measurement1, measurement2, color) with linewidth more then 1px
I know about Windows & Angle. I searched & try to solve this problem a few days (most of the found methods not worked or work only in 2D or have problems inside)
lineMat = new THREE.LineBasicMaterial({color, linewidth: 5});
doesn't work.
I need a simple method for 3D (rotating scene): drawLine(measurement1, measurement2, color) with linewidth more then 1px
I know about Windows & Angle. I searched & try to solve this problem a few days (most of the found methods not worked or work only in 2D or have problems inside)
Share Improve this question edited Aug 15, 2019 at 12:54 xalex asked Aug 15, 2019 at 12:46 xalexxalex 491 silver badge4 bronze badges2 Answers
Reset to default 3It does not work since WebGL line primitives are always rendered as 1px wide lines. However, three.js
provide the possibility to render so called wide or fat lines based on triangles. So using the classes LineGeometry
, LineMaterial
and Line2
should solve your issue.
Official example: https://threejs/examples/webgl_lines_fat
three.js R107
Thanks to @Stranger in the Q
https://github./spite/THREE.MeshLine
import * as THREE from 'three';
import { MeshLine, MeshLineMaterial} from 'three.meshline';
drawLine(measurement1, measurement2, color) {
const geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3( measurement1.X, measurement1.Y, measurement1.Z ),
new THREE.Vector3( measurement2.X, measurement2.Y, measurement2.Z )
);
const line = new MeshLine();
line.setGeometry( geometry );
const material = new MeshLineMaterial({color});
const mesh = new THREE.Mesh( line.geometry, material );
this.scene.add( mesh );
}
本文标签: javascriptThree JS LineBasicMaterial how to draw simple fat line in 3D axisStack Overflow
版权声明:本文标题:javascript - Three JS LineBasicMaterial how to draw simple fat line in 3D axis? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745271932a2650945.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论