I need to implement curves that look like the following:
I was provided the SVGs for these lines, which I imported into Blender and exported as a JSON file with the positions of each vertex. The data I got was in the following format:
{
"points": [
{
"x": 3.1263577938079834,
"y": 0.11644318699836731,
"z": 4.950274467468262
},
{
"x": 3.105274200439453,
"y": 0.09999111294746399,
"z": 4.950274467468262
},
// a lot of points
}
Each line has 95 vertices.
Then, in Three I created lines as follows:
import lineData from "linedata.json";
const vertices = [];
const colors = [];
const pts = lineData.points;
for (let i = 0; i < pts.length; i++) {
const { x, y, z } = pts[i];
vertices.push(x, y, z);
// here I use a helper function that interpolates between colors
// based on the position of the index of the vertex
// returns 3 values between 0 and 1
colors.push(...getColor(i / pts.length));
}
const geometry = new LineGeometry();
geometry.setPositions(vertices);
geometry.setColors(colors);
const material = new LineMaterial({
color: 0xffffff,
lineWidth: 1,
resolution: new THREE.Vector2(window.innerWidth, window.innerHeight),
vertexColors: true,
});
const line = new Line2(geometry, material);
scene.add(line);
The result is:
I tried adding more geometry by increasing the curve resolution in Blender before converting to a mesh, but didn’t help at all.
I tried other approaches, like Line, Tube and MeshLine, but still can’t get the result I need.
What am I doing wrong and/or is there a better way of doing this type of thin thread-like object?
Should I just render the SVG? I strongly prefer having the curve as an actual Threejs object so I can manipulate its material and other properties.


