sp4cerat / Fast-Quadric-Mesh-Simplification

Mesh triangle reduction using quadrics
MIT License
1.51k stars 237 forks source link

Holes inside the models #11

Closed binaryzebra closed 6 years ago

binaryzebra commented 6 years ago

Hello,

I am trying to use your algorithm in my experiments, but as a result, I get holes inside my mesh. Could you please clarify how the model should be prepared to avoid holes after simplification?

I assume in my model there are many points that have identical or close coordinates but have different uvs, or normals. Does you algorithm handle such cases?

Best regards,

sp4cerat commented 6 years ago

can you upload a test mesh ? then i may be able to tell

binaryzebra commented 6 years ago

sphere.obj.zip sphere_out.obj.zip

This is simple ICO sphere i can see bugs on. I have another model more complex. I can send it to you in private.

Sphere was simplified on mac os, using simplify tool from bin.OSX.

sp4cerat commented 6 years ago

just noticed that your file has duplicate vertices. you need to fix that to avoid the holes. meshlabs mesh reduction also creates holes with your file due to that.

binaryzebra commented 6 years ago

duplicates are because of normals tangents and binormals and uvs. I fastly exported that to give the model. So technically it's different vertices.

What would you recommend to do with such models when positions are the same, but vertices are technically different.

binaryzebra commented 6 years ago

Am I understand correctly that if I will put uvs, and normals, algorithm will manage such models better?

sp4cerat commented 6 years ago

well you can store uvs, normals and tangents per triangle (3 per triangle) and remove duplicate vertices. the reduction will in any case reduce the quality of the uvs and normals however as uv and material seams are not considered when reducing the triangles. to get a good quality, you would need to reduce the mesh by removing duplicate vertices first, then generate a uv layout, then transfer the normal and texture data to the lores meshs normal map and texture map.

binaryzebra commented 6 years ago

Thanks for the help and fast response.

Am I understand correclty that I can extend void update_uvs(int i0, const Vertex& v, const vec3f& p, std::vector& deleted) To handle 3 normals per triangle in the same way how you handle uvs. Do you think same inteprolation strategy will work for normals?

Also I think I can drop targents, and rebuild tangent space after simplification. If uvs will be good and normals will be good, I can rebuild tangent & binormal later.

sp4cerat commented 6 years ago

I can understand that. I believe most important is to keep the hope that it will become better in the future. Also wish you to recover soon!

yes

Also I think I can drop targents, and rebuild tangent space after simplification. If uvs will be good and normals will be good, I can rebuild tangent & binormal later.

thats something you need to check if these are good

binaryzebra commented 6 years ago

Thanks.