Line2 / Fat Lines Rendering Artifact Plane

When I add a Line2 object to the scene/loaded GLTF file, I’m getting this weird plane showing up on the corner of my model. When I remove the Line2 object the weird plane goes away.


Any ideas what might be causing the plane artifact, or how to get rid of it?

Here is the code that adds the Line2 object:

function CreateLines(verts){

    const geometry = new LineGeometry();
    geometry.setPositions( verts );

    matLine = new LineMaterial( {
        color: 0x59a8b6,
        linewidth: 0.01,
        alphaToCoverage: false,
    } );

    line = new Line2( geometry, matLine );
    houseGLTF.add( line );
}

Thanks!

1 Like

Alright I gave up on trying to use the line renderer and just made a function that creates and scales cubes.

Here is the new working code for the next person who runs into this problem:

// creates the floorplan outlines for the currently selected room
function CreateLines(verts){

	line = new THREE.Group();

	for(var i = 0; i < verts.length; i++){

		let nextIndex = i + 1 > verts.length - 1 ? 0 : i + 1;
		let distance = getDistance(verts[i], verts[nextIndex]);

		//get the midpoint between the current and next vertex
		let midX = (verts[i].x + verts[nextIndex].x) / 2.0;
		let midY = (verts[i].y + verts[nextIndex].y) / 2.0;
		let midZ = (verts[i].z + verts[nextIndex].z) / 2.0;

		
		//create box, size it, and apply material
		const boxSize = 0.2;
		const geometry = new THREE.BoxGeometry( boxSize, boxSize / 2, distance );
		const cube = new THREE.Mesh( geometry, lineMaterial );

		//position box between points
		cube.position.x = midX;
		cube.position.y = midY;
		cube.position.z = midZ;

		//look at the next point
		cube.lookAt(verts[nextIndex].x, verts[nextIndex].y, verts[nextIndex].z);

		//add the box to the line group
		line.add( cube );
	}

	//add the line group to the scene
	houseGLTF.add( line );
}
1 Like

i’ve seen this often enough to think this is the postpro pass being unable to handle the line shader and instead it renders, i don’t know, the screen quad? i get the same thing with ssr and it’s annoying to say the least.

1 Like