sp4cerat / Fast-Quadric-Mesh-Simplification

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

Material loss #40

Open lwh504530121 opened 1 month ago

lwh504530121 commented 1 month ago

First of all thank you for open source! I encountered some problems in the process of using, I took the obj model input with material (.mtl) and simplified the output model without material, how do I associate the material back?

neurolabusc commented 1 month ago

I was able to simplify this obj file and view it with MeshLab. Note that the texture (.jpg) and material (.mtl) files are not changed, only a new obj file is created.

$ git clone git@github.com:sp4cerat/Fast-Quadric-Mesh-Simplification.git
$ cd Fast-Quadric-Mesh-Simplification/src.cmd
$ make
$ ./simplify ~/pineapple2/pineapple2.obj ~/pineapple2/pineapple23.obj 0.2
Mesh Simplification (C)2014 by Sven Forstmann in 2014, MIT License (64-bit)
loading obj
Input: 17169 vertices, 34271 triangles (target 6854)
iteration 0 - triangles 34271 threshold 2.187e-06
exporting obj
Output: 3449 vertices, 6854 triangles (0.199994 reduction; 0.0239 sec)
Screenshot 2024-08-24 at 9 15 40 AM Screenshot 2024-08-24 at 9 16 27 AM
lwh504530121 commented 4 weeks ago

我能够简化这个obj 文件并使用 MeshLab 查看它。请注意,纹理 (.jpg) 和材质 (.mtl) 文件没有更改,只创建了一个新的 obj 文件。

$ git clone git@github.com:sp4cerat/Fast-Quadric-Mesh-Simplification.git
$ cd Fast-Quadric-Mesh-Simplification/src.cmd
$ make
$ ./simplify ~/pineapple2/pineapple2.obj ~/pineapple2/pineapple23.obj 0.2
Mesh Simplification (C)2014 by Sven Forstmann in 2014, MIT License (64-bit)
loading obj
Input: 17169 vertices, 34271 triangles (target 6854)
iteration 0 - triangles 34271 threshold 2.187e-06
exporting obj
Output: 3449 vertices, 6854 triangles (0.199994 reduction; 0.0239 sec)

截图于 2024-08-24 上午 9 15 40 截图于 2024-08-24 上午 9 16 27

image image The texture photos and materials were associated in the obj file via mtllib xxxx.mtl and usemtl xxx, and the obj file was lost after simplify output

neurolabusc commented 4 weeks ago

I am unable to replicate with the sample image, version and compilation I provide above. As you can see, the material file is retained for the pineapple. It is unclear if the difference reflects the file you are converting or the version of this software you are using. You can trouble shoot this by following the recipe I provide above. If the software works for the pineapple, but not with your mesh, you will need to share a copy of your mesh to allow replication of the issue.

simplify