I’m trying to get .stl files to appear smooth, but the edges result in these weird dark areas.
With flatShading set to true
With flatShading set to false
Is there any way to make the edges perfectly smooth without these weird artifacts? Here’s the working code https://codepen.io/Mazvy/pen/xxGREmX
it is as far as automatic normals can take you, I guess, you need to edit the normals in 3D software
Is that possible with something like Meshmixer? I only have the .stl files
I am not sure what is intended effect, but maybe you could just split the mesh into multiple meshes at hard edges, and then do whatever you did at screen 2 again
The intended effect is to to have the entire model smooth, like in the web viewer for Fusion 360. The exact same .stl file is used in my example and I’ve imported that same mesh into this Fusion360 project. https://a360.co/39SXns7 Somehow they’re displaying it almost perfectly smooth.
It’s possible to do what you’re talking about by first caching which faces are connected and only averaging normals for vertices for faces within some angle threshold. I added some similar functionality to LDrawLoader but unfortunately there’s not a version that works generally for any BufferGeometry. It would be a good addition, though!
Solved it, found this great function https://codepen.io/Ni55aN/pen/zROmoe
Results in exactly what I want after playing around with the angle, however increases loading time and has a bit of a performance penalty when a bunch of meshes are loaded, something I can live with as the meshes look amazing. I tried exporting the meshes so the browser wouldn’t have to recalculate every time, but some of them inflated 5-10 times due to this process. So it’s a sacrifice of loading time either way.
again, if you split the mesh at hard edges, and export without normals, you should not see any significant size increase (although if stl does not support multiple meshes, you would need multiple stl-s or another format).
I can’t find anything automated. I have ~200 meshes that need this treatment with more coming in, I can’t do this manually. If you can link to a solution that could do it for me, that’d be great.
Idk about that, sorry. Is tweaking the angle for every one of those 200 models not “manual” ? Quick google says there is some modifier in blender that does something similar https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/edge_split.html feel free to try - I did not use it.
I “calibrated” the angle with this specific mesh and it works great for all meshes, I don’t have to adjust angles and am using just one universally.