Open giuliobrugnaro opened 4 years ago
@hujiulong is flatShading
false by default for the model-stl
? Could it be a way to achieve the smoothing for STL files? If so, could you indicate me where I can change this option? Thanks!
Hi @hujiulong , do you have any suggestions for me? I haven't managed yet to figure out how to address the issue ;/
This rendering result is because the geometry has no normals, you can choose to bring the normal information when exporting the model, Or, like the smooth
prop of obj-model, recalculate the normals.
Thank you @hujiulong. I have tried to replicate what happens for the smooth
prop of obj-model in the stl-model component (see below), but the result is even weirder (see picture). Am I missing something?
methods: {
getObject(geometry) {
geometry = toIndexed(geometry);
geometry.computeFaceNormals();
geometry.computeVertexNormals();
return new Mesh(geometry, new MeshPhongMaterial());
},
},
This is the results with only geometry = toIndexed(geometry);
@hujiulong I have modified the getObject
function in the model-stl
component as below but unfortunately the result is still similar to the previous images. Do you have any suggestion? I'm stuck and not sure what to try next. Thank you!
getObject(geometry) {
geometry = new Geometry().fromBufferGeometry( geometry );
geometry.mergeVertices();
geometry.computeVertexNormals();
geometry.computeFaceNormals();
geometry = new BufferGeometry().fromGeometry( geometry );
return new Mesh(geometry, new MeshPhongMaterial());
},
I am using the
model-stl
component to display STL files. For most of them, their "resolution" is quite low (due to conversion) and they have segmented corners instead of smooth round ones (see attached screenshot). Is there a way to smooth the STL model during the visualization? I know there is the 'smoothing' prop for OBJ models. Thanks!