Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jessekirbs opened this issue Nov 18, 2019 · 22 comments
Closed

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

jessekirbs opened this issue Nov 18, 2019 · 22 comments
Labels
stale for issues that becomes stale (no solution) type:question

Comments

@jessekirbs
Copy link

jessekirbs commented Nov 18, 2019

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"
  • OS: Windows 10
  • Python 3.7 (64-bit)
  • Qt/PySide version (not sure how to check this, but my only instance of PySide is from the Meshroom tools lib folder.
  • Meshroom 2019.2.0
@natowi
Copy link
Member

natowi commented Nov 19, 2019

@jessekirbs
Copy link
Author

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
Copy link
Member

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
Copy link
Author

@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
Copy link
Member

"[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"

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

@jessekirbs
Copy link
Author

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
Copy link
Member

@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
Copy link
Author

jessekirbs commented Nov 19, 2019

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
Copy link
Member

And if you load it in blender or meshlab?

@jessekirbs
Copy link
Author

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

errors

@curtthemartian
Copy link

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
Copy link
Author

jessekirbs commented Nov 23, 2019

@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
Copy link

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
Copy link
Author

@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
Copy link
Member

natowi commented Nov 24, 2019

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
Copy link
Author

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

@thomasderijk
Copy link

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
Copy link

stale bot commented Apr 7, 2020

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 stale bot added the stale for issues that becomes stale (no solution) label Apr 7, 2020
@stale
Copy link

stale bot commented Apr 14, 2020

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

@stale stale bot closed this as completed Apr 14, 2020
@BLAHBLAHneeb
Copy link

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
Copy link

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
Copy link

bicukow commented Feb 11, 2023

I found the solution that fits in my workflow, I do not want to duplicate it, so check it out in another issue
#236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale for issues that becomes stale (no solution) type:question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants