Hello, I’m new to the three js world and I’m doing a small project of a 3D printer that can print two types of objects (Extrusion and Revolution). For the revolution type I’m using LatheGeometry. I made a Path for every model I need. Here’s the code that creates the mesh
shape = Curves[GUIController.Revolution_Shape].getPath()
shapeGeometry = new THREE.LatheGeometry( shape.getPoints(), GUIController.Print_Steps, 0, 2*Math.PI );
shapeGeometry = THREE.BufferGeometryUtils.mergeVertices(shapeGeometry, 0.05)
shapeGeometry.computeVertexNormals();
shapeMaterial = new THREE.MeshPhongMaterial({
color: GUIController.Print_Color,
clippingPlanes: [this.clippingPlane],
flatShading: false,
})
const print = new THREE.Mesh(shapeGeometry, shapeMaterial)
And here’s an example of one curve
"A1": {
getPath: () => {
const path = new THREE.Path()
path.moveTo(0.0,0.0)
path.lineTo(-0.5,0.0)
path.lineTo(-0.5,0.125)
path.lineTo(-0.165,0.25)
path.bezierCurveTo(-0.375,0.375,-0.375,0.625,-0.165,0.75)
path.lineTo(-0.5,0.875)
path.lineTo(-0.5,1.0)
path.lineTo(0.0,1.0)
return path
},
type: "Rev"
}
Here’s the light of the scene
/Add Point Light
const pointLightColor = 0xFFFFFF
const pointLightIntensity = 0.75
const pointLight = new THREE.PointLight(pointLightColor, pointLightIntensity)
pointLight.position.set(0, 5, 0)
scene.add(pointLight)
But, when the object is rendered it has a little artifact from where it started and ended the revolution
Does anyone knows what can be the cause? I tried not computing the vertexNormals and the artifact goes away but the lightning is all messed up. Been trying to fix this for a few days now and nothing worked