1
votes

I have a polygon mesh of a room in high resolution, and I want to extract vertices color information and map them as a UV map, so I can generate a texture atlas of the room.

After that, I want to remesh the model in order to reduce the number of polygons and map the hi-res texture onto the new mesh in lower resolution.

So far I've found this link to do it in Blender, but I would like to do it programmatically. Do you know about any library/code that could help my in my task?

I guess first of all I have to segment the model (normals criterion could be helpful) and then cut each mesh segment, so only then I am able to parameterize it. About parameterization, LSCM seems to provide good results for simple models. Once having available the texture atlas, I think the problem becomes a simple task of texture mapping.

My main problem is segmentation and mesh cutting. I'm using CGAL library for that purpose, but the algorithm is too simple to cut complex shapes. Any hint about a better segmentation/cutting algorithm that performs well for room-sized models?

EDIT:

The mesh consists in a room reconstructed with a RGB-D camera, with 2.5 million vertices and 4.7 million faces. The point is to extract high resolution texture, remesh the model to reduce number of polygons and then remap the texture onto it. It's not a closed mesh, and there are holes due to reconstruction, so I'm guessing if my task is not possible to accomplish at all.

I attach a capture of the mesh.

enter image description here

2
The segmentation method to be used depends on the mesh. Could you add an image of your mesh so that we can have an idea and redirect you to the best method ?BrunoLevy
Thank you @BrunoLevy for your comment. It's good to see that the author himself is interested in the question. I've already edited the question with a picture of my mesh.Finfa811

2 Answers

4
votes

I would suggest using the following 4-steps procedure:

  • Step 1: remesh

For this type of mesh that comes from computer vision, you need a remesher that is robust to holes, overlaps, skinny triangles etc... You can use my GEOGRAM software [1]. Use the following command:

vorpalite my_input.obj my_output.obj pre=false post=false pts=30000

where 30000 is the number of desired points (adapt it to the complexity of your input). Note: I am deactivating pre and post-processing (pre=false post=false) that may remove too much parts of the mesh for this type of mesh.

  • Step 2: segment the remesh

My favourite method is "Variational Shape Approximation" [3]. I like it because it is simple to implement and gives reasonable results in most cases.

  • Step 3: parameterize

Besides my LSCM method, you may use ABF++ that we developed after [4], that gives much better results in most cases. You may also try ARAP [5].

  • Step 4: bake the texture

Once the simplified mesh is parameterized, you need to copy the colors from the original mesh onto the new one. This means determining for each pixel of the texture where it goes in 3D, and finding the nearest point in the original 3D mesh.

Segmentation, parameterization and baking are implemented in my Graphite software [2] (use the old version 2.x, the newer version 3.x does not have all the texturing functionalities).

[1] geogram: http://alice.loria.fr/software/geogram/doc/html/index.html

[2] graphite: http://alice.loria.fr/software/graphite/doc/html/

[3] Variational Shape Approximation (Cohen-Steiner, Alliez, Desbrun, SIGGRAPH 2004): http://www.geometry.caltech.edu/pubs/CAD04.pdf

[4] ABF++: http://alice.loria.fr/index.php/publications.html?redirect=1&Paper=ABF_plus_plus@2004

[5] ARAP: cs.harvard.edu/~sjg/papers/arap.pdf

1
votes

For reducing the number of polygons, I prefer using mesh decimation. My recommended workflow: (Input: High resolution mesh(mesh0) with vertex color).

  1. Compute uv coordinates for mesh0.
  2. Generate texture image(textureImage) by vertex color. Thus, you have a texture mesh(mesh0 with uv coordinates, textureImage).
  3. Apply mesh decimation to mesh0, and the decimation should take uv coorindates into consideration.

I have an example about this workflow in my site, the example image: Decimation of texture mesh . Or you can refer my site for details.