Is there a way to create a Three.js 3D line series with customizable width and thickness?
Although the Three.js line object does have a linewidth attribute, it is not universally supported across all browsers and platforms in WebGL.
Here is how you can set the linewidth in Three.js:
var material = new THREE.LineBasicMaterial({
color: 0xff0000,
linewidth: 5
});
The previous Three.js ribbon object, which had width, has recently been eliminated.
When it comes to the Three.js tube object, it can generate 3D extrusions, but the lines do not go through the control points due to their Bezier-based nature.
Does anyone know of a method to draw a line series (such as polylines or plotlines) in Three.js with user-defined 'bulk' like width, thickness, or radius?
This question might be a rephrasing of the following question: Extruding a graph in three.js.
If there isn't an existing solution, I am open to collaborating on creating a simple function to address this question.
However, it would be great if someone could point out an already established method...
One possible solution proposed by WestLangley is to have the polyline maintain a constant pixel width, similar to what the Three.js canvas renderer currently offers.
Check out a comparison of the two renderers here:
Canvas and WebGL Lines Compared via GitHub Pages
Canvas and WebGL Lines Compared via jsFiddle
An ideal solution would allow for specifying linewidth and achieving consistent results across both renderers.
Furthermore, there are alternative approaches to 3D lines that involve realistic physical constructs, complete with shadows and interactivity. These avenues also warrant exploration.
Here are demos showcasing lines composed of multiple meshes on GitHub Pages:
Sphere and Cylinder Polylines
An intricate solution where each joint consists of a full sphere.
Cubes Polylines
It's likely that creating these as seamless single meshes will present complex challenges. In the meantime, here is a link to a partial visualization of wide, tall 3D lines:
The aim is to simplify the coding process "for dummies." As a result, creating a 3D line should be as straightforward and familiar as adding a sphere or cube. Geometry + material = mesh > scene. The geometry should be efficient in terms of vertices and faces creation.
The lines should possess both width and height, with the Y direction always pointing upward. The demo showcases this, although it does not tackle mitering corners seamlessly...