alicevision / Meshroom

3D Reconstruction Software
http://alicevision.org
Other
11.22k stars 1.09k forks source link

How can I create new UVs and retexture an externally edited mesh? #706

Closed jessekirbs closed 4 years ago

jessekirbs commented 4 years ago

I've imported a decimated mesh in Blender, smoothed out some areas and exported as a new OBJ. In Meshroom, I create a new Texturing node, and only change the inputMesh to the corresponding file path for the new OBJ. I right click and select 'Compute'. It seems like it loads the mesh, but then it fails. I can't seem to decipher why it's failed from the log.

If I do this same process using the mesh created from the Texturing node, I can get it to work but the new texture has holes and weird UVs. I'd like Meshroom to create new UVs and retexture the new mesh so that everything looks correct. Any help would be greatly appreciated. Thank you!

Program called with the following parameters:
 * angleHardThreshold = 90
 * bestScoreThreshold = 0.1
 * correctEV = 0
 * downscale =  Unknown Type "unsigned int"
 * fillHoles = 0
 * flipNormals = 0
 * forceVisibleByAllVertices = 0
 * imagesFolder = "H:/Musiv/MeshroomCache/PrepareDenseScene/349635900e5f70ccfcbcd8abc82bc6c6c30a6279"
 * input = "H:/Musiv/MeshroomCache/Meshing/308e847de34770397d0a807a254f8ae633a07a08/densePointCloud.abc"
 * inputMesh = "H:/Musiv/MeshroomCache/MeshDecimate/a6c68701aa45c8a7c5826b147ae577bda072787f/mesh.obj"
 * multiBandDownscale =  Unknown Type "unsigned int"
 * multiBandNbContrib =  Unknown Type "class std::vector<int,class std::allocator<int> >"
 * output = "H:/Musiv/MeshroomCache/Texturing/a6d781178438370570ea2aeda5f45c836a4e65be"
 * outputTextureFileType = "png"
 * padding =  Unknown Type "unsigned int"
 * processColorspace = "sRGB"
 * textureSide =  Unknown Type "unsigned int"
 * unwrapMethod = "Basic"
 * useScore = 1
 * useUDIM = 1
 * verboseLevel = "info"
 * visibilityRemappingMethod = "PullPush"

[13:28:45.207091][info] Found 1 image dimension(s): 
[13:28:45.208087][info]     - [3840x2160]
[13:28:45.353730][info] Overall maximum dimension: [3840x2160]
[13:28:45.353730][info] Loading mesh from obj file: H:/Musiv/MeshroomCache/MeshDecimate/a6c68701aa45c8a7c5826b147ae577bda072787f/mesh.obj
[13:28:45.667429][info]     - # vertices: 140278
    - # normals: 280551
    - # uv coordinates: 0
    - # triangles: 0
[13:28:46.718999][info] Mesh loaded: 
    - #points: 140278
    - # triangles: 0
    "commandLine": "aliceVision_texturing  --input \"H:/Musiv/MeshroomCache/Meshing/308e847de34770397d0a807a254f8ae633a07a08/densePointCloud.abc\" --imagesFolder \"H:/Musiv/MeshroomCache/PrepareDenseScene/349635900e5f70ccfcbcd8abc82bc6c6c30a6279\" --inputMesh \"H:/Musiv/MeshroomCache/MeshDecimate/a6c68701aa45c8a7c5826b147ae577bda072787f/mesh.obj\" --textureSide 8192 --downscale 1 --outputTextureFileType png --unwrapMethod Basic --useUDIM True --fillHoles False --padding 5 --correctEV False --useScore True --processColorspace sRGB --multiBandDownscale 4 --multiBandNbContrib 1 5 10 0 --bestScoreThreshold 0.1 --angleHardThreshold 90.0 --forceVisibleByAllVertices False --flipNormals False --visibilityRemappingMethod PullPush --verboseLevel info --output \"H:/Musiv/MeshroomCache/Texturing/a6d781178438370570ea2aeda5f45c836a4e65be\" ",
    "env": null,
    "startDateTime": "2019-11-18 13:28:42.823447",
    "endDateTime": "",
    "elapsedTime": 0,
    "hostname": "DESKTOP-LJLQTMC",
    "sessionUid": "2c1aed4a-0a4a-11ea-9a30-d0509985daa1",
    "returnCode": 3221226505,
    "elapsedTimeStr": "0:00:00"
natowi commented 4 years ago

See https://github.com/alicevision/meshroom/wiki/Texturing-after-external-re-topology

jessekirbs commented 4 years ago

Thanks for the reply, @natowi ! This is exactly what I attempted, and I can't get it to work with a modified decimated mesh. I can only get it to work on the mesh produced by a previous 'Texturing' node. The issue being when I retexture this mesh, it has weird spots and holes where I've smoothed things out externally. I believe this is because it is not recalculating the UVs. Can you offer any more advice on how to remedy this? Thank you!

fabiencastan commented 4 years ago

If the mesh you give in input of the Texturing has UVs, the texturing will use it. So if you want to recompute them, export your model after retopology without UVs.

jessekirbs commented 4 years ago

@fabiencastan Unfortunately that's where it's failing for me. I can retexture just fine when the mesh has UVs but for some reason when I delete the UVs and export the OBJ and try to retexture, the node fails.

fabiencastan commented 4 years ago

"[13:28:45.667429][info] - # vertices: 140278

It seems that your mesh has no triangle or they are not recognized. Could you send your OBJ file?

jessekirbs commented 4 years ago

I saw that too and thought it was strange because it imports into Blender with no issues from what I can tell. I've linked the file below. Thanks, @fabiencastan!

https://www.dropbox.com/s/jya8208291i67zw/Bar.obj?dl=0

fabiencastan commented 4 years ago

@jessekirbs Could you try to open your OBJ file in a text editor and replace all "//" by "/" and then try to relaunch the texturing again. It may be a stupid bug in our OBJ loader.

jessekirbs commented 4 years ago

We're getting somewhere... replacing '//' with '/' got the node to fully compute. However when I double click the node it loads and I see nothing in the 3D viewer.

fabiencastan commented 4 years ago

And if you load it in blender or meshlab?

jessekirbs commented 4 years ago

It does not import anything and I get the following errors:

errors

curtthemartian commented 4 years ago

The process to remap that I learned is to run the full thing using the normal sequence, then pull out the mesh file or even the textured file edit it to fill holes, and then use the meshdecimate node from the right click menu. Have you tried that? I assume you have since you described the decimate mesh, but I wanted to be sure.
If you haven't then use the mesh decimate node with only the new mesh as an input then replace the input for mesh filtering or texturing. As long as there is data for the cameras to produce a mesh and the mesh has sufficient triangles it should work.
I have done that for several rooms that I wanted to produce a photogametric model of.
Good luck!

jessekirbs commented 4 years ago

@curtthemartian Running MeshDecimate on the externally edited mesh does seem to do the trick to allow Meshroom to retexture it again. Thank you very much for the suggestion.

Do you have any advice on how to patch large missing areas and texture them to match? For example this large missing chunk of a bar top:

bar

Would love to hear any ideas. Thanks so much.

curtthemartian commented 4 years ago

Lots of hours of work to patch holes. No quick way that I know of. Just the normal way of doing triangle by triangle, or maybe a group of points, but you have to be very careful otherwise you can cause layering issues and when it goes to do a texture, it cant see it correctly. I have done the same when I did a model of my parent's basement, and a model of their property. It takes hours to fill holes.

jessekirbs commented 4 years ago

@curtthemartian Which kind of layering issues do you mean? Can Meshroom fill in the correct textures once you've patched holes or do you have to somehow paint the texture on separately? Are you using Blender? And if so would you mind sharing the basic technique? Thanks so much.

natowi commented 4 years ago

I think there is a tool in Meshlab that can "project" an image on a mesh. It might be possible to fix holes in the mesh, then project a matching image onto the surface and merge the textures.

Edit: here it is MeshLab Basics: Raster Layers

jessekirbs commented 4 years ago

@natowi I'll explore that option. Thanks for the help!

thomasderijk commented 4 years ago

I have the exact same issue. It's not so much a workflow issue, the issue is that the texture node refuses to load the model. Some searching showed this as a bug end of last year, which was due to the obj having normals (which happens if you export from zbrush / blender etc). I've completely removed those but the model is still not being loaded. Thus making it impossible to retexture a clean model with clean uvs, using the projection from the 3d scan.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue is closed due to inactivity. Feel free to re-open if new information is available.

BLAHBLAHneeb commented 4 years ago

Using 2019.2.0 as well. Been working on a bison model for a while now and had a lot of these same issues. Plugged a retopod & quadded obj into mesh decimate with a simplification factor of 1 (as to not lose any detail) and it textured just fine. Only problem is the decimate node converts the model into triangles again by splitting the quads. Tried using the og input mesh with the fixes mentioned above, but none worked (in one case replacing the "//" did texture, but at a terrible and pixelated quality). It'd seriously be great if the program either actually accepted obj from external software or didn't automatically convert to triangles with meshdecimate. Currently trying to use Maya tools to fix the topology again but they aren't really working. I might just need to go over this one manually, which majorly sucks since all this could be avoided if Meshroom retexture tools acted properly.

bison

julianrendell commented 4 years ago

I'm a 3D beginner... but I've had luck with instant meshes (only does the mesh though) and Meshmixer.

I recently found out about Meshlab's ability to project images -> meshes for texturing; it includes guided alignment between images and a mesh (https://www.youtube.com/playlist?list=PL60mCsep96JdC8Y7NQvLIMxx8XzXCT3iK). They now have monthly builds; I have no idea how well it works, but it's on my list of things to try.

I'm thinking photogrammetry in Meshroom -> meshlab/meshmixer -> instant meshes -> mesh lab for texturing might be a very powerful workflow, leveraging each tools areas of strength.

bicukow commented 1 year ago

I found the solution that fits in my workflow, I do not want to duplicate it, so check it out in another issue https://github.com/alicevision/Meshroom/issues/236