Forum

Author Topic: LODs and Metashape  (Read 3810 times)

gorenje

  • Newbie
  • *
  • Posts: 9
    • View Profile
LODs and Metashape
« on: August 05, 2021, 12:23:19 PM »
TL;DR: Is there a way to improve the quality of decimated meshes in Metashape?

I've been using Metashape (standard) for a while now and have began thinking about my workflow. In particular generating
various LOD (Level of Details) for each model. I post my models on SketchFab and noticed that, those users
that sell their models, have packs with various LODs (mostly various sized textures and reduced vertices/face counts).

To do the same, I've come up with a workflow to support various LODs:

1. define a single chunk with all photos
2. align those photos, generate dense cloud and mesh.
3. duplicate the chunk including all details  - one duplicate for each LOD
4. define a batch workflow which decimates and texturises the mesh for each LOD. I.e. a 4k+150k LOD decimates
the mesh to max 150k faces and generates a 4096 texture. this is possible since each step is limited to a specific chunk.
5. finally all models are exported using various placeholders in the filename

This works quite well except for the quality of the mesh. The decimated mesh has a lot of overlap in vertices and faces.
I have the feeling that the quality of a decimated mesh is never as good as the original. Is there a way to improve the
quality of the decimated mesh? I've tried refine mesh but that increased the vertex count  again.  Smooth mesh just
reduced the details of the mesh.

I ask because I've also used meshroom and noticed that the mesh there is perfect after decimation. In fact the mesh
produced by meshroom is a very constant even mesh.

Also I do a lot of post-processing in blender and it's a pain to clean up the mesh once for each LOD. So I want the best
quality mesh from metashape to reduce the amount of work I have in blender.

I initially began doing decimination in blender but then I have to rebake the texture. Which is basically a non-trival task!

Sorry for the long post & Cheers!

UPDATE: i've included a screenshot of the mesh differences, the highlighed mesh is meshroom.
« Last Edit: August 06, 2021, 10:16:57 AM by gorenje »

Bzuco

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: LODs and Metashape
« Reply #1 on: August 09, 2021, 12:08:23 PM »
Well you can try another workflow outside of metashape, probably same amount of time needed, but maybe with some advantages.
1. create dense cloud in metashape and export it
2. create several point cloud LODs in CloudCompare using subsample  function and use poison surface reconstruction on each LOD to create meshes...this should be faster, because you will be creating meshes from LOD point clouds and not allways from large dense cloud. Export meshes.
3. in blender or other software unwrap meshes for texturing
4. export meshes from blender and dense cloud from CloudCompare/ Metashape
5. import everything to meshlab and use Transfer Vertex Attributes To Texture. This will bake dense pointcloud colors to texture.

I used this workflow in few projects, because I only have standard ver. of Metashape and I am applying transforms on pointcloud in cloudcompare so then it is not easy to bake photos from original camera positions to mesh texture. Also creating texture from photos takes some time. Transfering point colors to texture is faster process.

This workflow brings maybe less problems in creating and cleaning meshes. One disadvantage is that you are baking point colors and not original photos...but if your dense cloud is dense enough, then it should be not so problem. MeshLab is able to create script from last used functions which also speed up overall work. CloudCompare has function to cleanup noise in dense cloud...it should help create better mesh without additional needs of clean it.

I hope some of my tips will help you.

gorenje

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: LODs and Metashape
« Reply #2 on: August 09, 2021, 12:28:41 PM »
Thank you for those tips :)

I've used MeshLab but had not heard of CloudCompare, I will have a look.

I do want to avoid baking textures - have to be honest - and since I'm reducing the mesh by 90% in some cases, I would assume that the vertex colours won't
be enough to bake a detailed texture, so I would really want to use the original photos.

I think I might have found a third approach and that would be to limit the number of faces/vertices when building the mesh - basically going up one step in my
workflow. So instead of decimating the mesh, I would create smaller meshes right from the start. That would also remove one step from my workflow - i.e. the decimation
step.

I'll have a try of that and see how that goes!

Thanks again and Cheers!


Bzuco

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: LODs and Metashape
« Reply #3 on: August 09, 2021, 01:27:44 PM »
Even if you reduce the mesh by 90% it does not matter, because you would always be baking original dense point cloud colors(not vertex colors from mesh) to texture even on smallest LODxy.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: LODs and Metashape
« Reply #4 on: August 09, 2021, 01:40:27 PM »
Hello gorenje,

You can use Texture Transfer option, if you would like to transfer the texture from the high-poly mesh to the low-poly model in the same chunk. In this case in the Build Texture dialog you need to select the high-poly model in the Source field instead of Images option and enable Transfer Texture option.
Best regards,
Alexey Pasumansky,
Agisoft LLC

gorenje

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: LODs and Metashape
« Reply #5 on: August 09, 2021, 01:54:07 PM »

@Bzuco:

Ah ok then I misunderstood. So the quality would be the same regardless of vertex/face count.

Does CloudCompare generate smooth meshes, i.e. comparable to want meshroom does? That would be ideal.

Either way, I'll have a look and give it a try.


@Alexey:

I had a quick look at an existing project and for me I could only select a different source for an Occlusion map?

And can I have multiple meshes/models in one chunk? If so how! :) That would be great and would save me
duplicating chunks for the LODs.


Thanks to both of you for the help :thumbsup:

Bzuco

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: LODs and Metashape
« Reply #6 on: August 09, 2021, 04:08:18 PM »
Yes, same vertex/face count. And the texture quality depends on: 1. quality in build dens cloud dialog in metashape, 2. texel density of your mesh after unwrapping(less chunks and better packed in UV space means higher details in final texture).
CloudCompare does not generate as smooth meshes as meshroom...it is simple poisson algorithm, where you can set distances between vertexes in metric units and three methods of mesh boundary. Meshroom is probably using some retopology algorithm so the topology is uniform and smooth. I think meshroom is good for LOD_0 mesh, but other LODs with higher number should have more precisely and effectively distributed vertexes across mesh, especialy if they will be used in games.(more vertexes in curvy areas and less in flat areas). Evenly distributed vertexes are not the best for LOD_1/2/3/...   But if you just need smooth meshes with less polygons, then meshroom does it's job great :)

For smaller objects will be probably better your workflow. I am dooing mostly exterior models with hundreds of photos, so for me blending so many photos to create one texture was not ideal solution and I dont even need such pixel density in final mesh texture as was on original photos. Therefor I choice just baking point colors to texture, because my dense clouds has density ~ 1point per 3mm and that is enough for exterior models(garden around house, ...).

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: LODs and Metashape
« Reply #7 on: August 09, 2021, 04:29:58 PM »

@Alexey:

I had a quick look at an existing project and for me I could only select a different source for an Occlusion map?

And can I have multiple meshes/models in one chunk? If so how! :) That would be great and would save me
duplicating chunks for the LODs.


Hello gorenje,

In the chunk's contents of the Workspace you need to right-click on existing model, then select Duplicate option from the context menu. Thus you'll get two identical models in the project.
To switch between models - double-click on their label in the Workspace pane or choose Set as Default option from the same context menu. All the operations are applied to the active (default) model only.

So you can decimate one of the models and then build texture for it using texture transfer option. I recommend to rename the model instances in the Workspace pane to avoid confusion.
Best regards,
Alexey Pasumansky,
Agisoft LLC

peterstib

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: LODs and Metashape
« Reply #8 on: November 29, 2021, 12:36:33 AM »
Alexey, I thought your two posts had solved the issue I'm working on but in your first answer you say 'select the high-poly model in the Source field instead of Images option'. When I try this, I am only offered 'Images' - no 'High-Poly Mpdel' and thus no 'Text Transfer' option.

The model I am trying this on is built within another 3D program but we need a decimated version. It has no photographic data behind it - we undertake the drone photography and photogrammetry as preparation for creating the models. The .fbx or obj. of the model load straightforwardly, but there is no camera information behind them. Decimation is fine on the mesh, but no texture.

My understanding of your second post on duplicating chunks is fine.

Delighted with the recent release which solved the timing problem we were having with the fly-round exports to AVI.