mosra/magnum

How to smooth imported mesh?

zaichenhu opened this issue · 2 comments

I have imported a triangulated mesh using magnum scene importer, but it was shaded flat when rendering. if there is any api to solve this problem?

change the compile flag to MeshTools::CompileFlag::GenerateSmoothNormals could work , sorry to disturb...

mosra commented

Yup, that's the flag :)

To answer fully -- smooth normal generation relies on the index buffer, so if the mesh is not indexed, you'll still get flat normals. To fix that, perform MeshTools::removeDuplicates() first, which will generate the index buffer.