How to make imported mesh smoother?

Hi everyone, I have a new question.
I import a mesh ( from a .stl file) , but so many edges on it, just like this Playground.
https://www.babylonjs-playground.com/#LLL145#14

I want to remove this edges and make the mesh smoother.

I search it on google and find some solutions. I try to solve my question but maybe it doesn’t fit my question.
This is one of solutions I found:
smooth dynamically generated mesh - Questions & Answers - HTML5 Game Devs Forum

Thank for everyone’s help!

1 Like

The best bet would probably be to import the mesh into Blender, smooth it out there, and then export it and just use that mesh.

1 Like

Hi, @TremblingV5
what’s wrong with @JohnK’s solution here: http://www.html5gamedevs.com/topic/32534-smooth-dynamically-generated-mesh/?do=findComment&comment=186606

Looks much better, just a small glitch in the geometry in one “end” of the mesh, but it was there to begin with.
https://www.babylonjs-playground.com/#LLL145#15

Just saw this was actually included in source from 4.0,
named Mesh.forceSharedVertices();
https://www.babylonjs-playground.com/#LLL145#16

1 Like

Hi @aWeirdo ! Thank for your reply!

I read your code and I think it’s effective, but it failed in my app.
I have two project, one of my projects use React + Babylon.js and another only use Babylon.js.
I use the same code in projects , Chrome console logs “Unable to import meshes from gingiva.stl: Error in onSuccess callback” when I start projects.

I confirm I use the same code in your PlayGround.

It successed in PlayGround but failed in my PlayGround, it’s an upsetting problem.

Hi @8Bit ! Thank for your reply!

The stl files I used in my app are from others and I can’t re-export it .
So I must solve it in code.

Hi @aWeirdo !

I’m back with some new discovery.

I found some other exception what about strict mode, so I think there may be some syntax errors in code.After reading code, I found that there’s a error in line 48 of this PG:
https://www.babylonjs-playground.com/#LLL145#15
Here should be “var _newNdata =[];”