alicevision / Meshroom

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

Textures Output Issue #211

Closed Wendy-Russo closed 4 years ago

Wendy-Russo commented 6 years ago

Hey, maybe it's obvouis but i always have 2 textures output, even if i set Max Nbr for imaes fusion to 1, i always get texture_0 and _1,and using only one gives me half black model (in blender) am i missing something or a setting ? in all the tutorials they only get 1 texture output ... amazing work otherwhise, thanks for your help !!

fabiencastan commented 6 years ago

Hi, maxNbImagesForFusion: Max number of images to combine to create the final texture. This parameter is a contraint to limit the number of source images we use in the color fusion. It is not related to the number of output texture files. There is no such parameter, the only thing you can do is to increase the image resolution.

If you decimate your mesh to a reasonable size, you can also change the unwrapMethod to LSCM or ABF which will generate only one texture file. But it will not work if you mesh is too heavy, check the tooltip:

Method to unwrap input mesh if it does not have UV coordinates.
  * Basic (> 600k faces) fast and simple. Can generate multiple atlases.
  * LSCM (<= 600k faces): optimize space. Generates one atlas.
  * ABF (<= 300k faces): optimize space and stretch. Generates one atlas.

What is the problem in having multiple texture files?

Wendy-Russo commented 6 years ago

omg thank you !! well the probleb is that it's weird to have 2 images for the same model, i'm a begginer so i had no idea how to merge them ... anyway thank you !!

Automoda commented 6 years ago

My first try went well with default settings as far as the built-in viewer goes. But when importing to 3dsMax, the texturedmesh.obj wanted 5 textures for the 3.5 million polygon result, but the mesh's polygons only had 2 texture IDs. The material is considered a 'multi-sub-object' and listed only 2 sub materials: Empty-gray and texture0.png and each coloring about half of the mesh.

So in 3D Studio it wont import in a useful way because of the lack of material IDs on the triangles. I could make my own material that'd work if only I had 5 IDs to match the 5 textures.

yann-lty commented 6 years ago

@Automoda how many materials are declared in the .mtl file next to the mesh? It's supposed to be the same as the number of textures (and of course the number of material used in the mesh). Is the textured mesh correctly displayed in Meshroom?

Automoda commented 6 years ago

Ok. The mtl file seems correct in that it shows a list of textures. On the other hand, the material when viewed in 3dsMax lists as a multi/sub-object material (thats how it should be) and explicitly has only 2 sub materials:
Name=TexturedMesh_mso ID=1 (empty gray) named "default" ID=2 (texture0.png) named "textureatlas_0"

The mesh itself, when tested by clicking random tris and also making a dummy multi/sub-object material that has a large list of materials showing as a different color only has 2 materialIDs on the triangles: Material 2 and Material 3.

For the obj import settings I'm checking "UV coordinates" and "import materials" Like I say, I can build my own texture if need be, but I need the surfaces to be set to the correct material ID for anything to work.

FYI ATLAS/TEXTURE GROUPS ARE BAD FOR SOME PIPELINES: Reading some documentation let me discover I could use a UV unwrap setting that forced 1 texture and set it to 8K, then downgrade in the final bake for the low poly, hand UV mapped game-ready version in Xnormal. It turns out I don't really want to use an atlas for that procedure in xnormal anyhow, though substance painter may allow it. (Xnormal doesn't seem to be set up for multiple source textures, showing only 1 slot for that)

My suggestion for the next big improvement then would be the ability to manually cull the unnecessary background polygons (a node for that) before continuing to the uv mapping to save half or more of the space on the texture. Density is the big issue with single-map bakes and auto-unwrapped UVs. You end up only using 20% of the pixels in the texture as it is now, so ginormous textures are the only solution at the moment if you want a 2K or 4K final baked texture.

realsammyt commented 6 years ago

I second this comment for a culling/cropping preprocess to be able to focus the texture on the desired object. Atlas mapping and multiple texture OBJs introduce excessive issues.

benlamasoon commented 6 years ago

@Automoda I'm having the same issue in 3dsmax. Did you mange to import models into Max with the correct texture coordinates? The .obj files have correct texture mapping in other programs like MeshLab and even the native Windows 10 obj viewer. I cant understand why it gets all screwed up in Max.

benlamasoon commented 6 years ago

Hi, maxNbImagesForFusion: Max number of images to combine to create the final texture. This parameter is a contraint to limit the number of source images we use in the color fusion. It is not related to the number of output texture files. There is no such parameter, the only thing you can do is to increase the image resolution.

If you decimate your mesh to a reasonable size, you can also change the unwrapMethod to LSCM or ABF which will generate only one texture file. But it will not work if you mesh is too heavy, check the tooltip:

Method to unwrap input mesh if it does not have UV coordinates.
  * Basic (> 600k faces) fast and simple. Can generate multiple atlases.
  * LSCM (<= 600k faces): optimize space. Generates one atlas.
  * ABF (<= 300k faces): optimize space and stretch. Generates one atlas.

What is the problem in having multiple texture files?

Hi @fabiencastan

The problem with multiple textures (from Meshroom specifically) is that they don't seem to be correctly mapped when imported to 3dsMax . This shouldn't be an issues because other photogrammetry programs like DroneDeploy have multiple texture atlases and they seem to work fine in Max.

Here is an example, the 'plinth' I scanned in Meshroom has 4 texture atlases but the imported Max model has only 2 sub objects. The strange thing is that other software packages (sketchfab, Meshlab) read the Meshroom texture correctly.

Meshroom; https://imgur.com/cQO7p3j

3dsmax: https://imgur.com/3XH5sqZ

Sketchfab: https://imgur.com/OAVLD2j

Any advice you can give would be greatly appreciated

Automoda commented 6 years ago

@benlamasoon, No, I never did get it to import as it was. What I did is made the UV unwrapper use one of the methods that forces 1 map and let it be an 8K map. That gave me enough texture data to work with for baking it back down to a game-ready object.

If we could trim the unnecessary polygons (the ones in the background that eat up pixels) and force 1 output texture even on high-poly meshes, and perhaps some manual UV fiddling, we'd be closer to something perfect.

Xnormal requires 1 texture to bake-down. Here's my first attempt, the final version imported to the Unity game engine. Its the rock outcrop thats cloned 3 times at different angles:

https://www.youtube.com/watch?v=cR7PKDBrYvY

benlamasoon commented 6 years ago

@Automoda Found a work around to fix this issue. Not great as it does not fix the problem but its easy.

Import .OBJ file into Blender and export as .FBX default settings. Takes about 30 seconds. Import to Max, all textures should come in as well provided they were in the same folder as the obj and fbx.

To anyone else reading Blender is free and you can get a feel for the program from CG geek https://www.youtube.com/watch?v=k4NTf0hMjtY&t=0s&index=2&list=LL0fPMTD3NGqQBRVHisJbrDA

drakev3 commented 5 years ago

I think it would be much easier to handle if instead of atlases it would make the UV on different UV sets, like UDIMS.

QuentinJouanisson commented 5 years ago

Hi there,

I'm having the same problem here, I'm retopology(ing?) the mesh in blender, Unwrapping it there, and sending it back to meshroom to texture it, and no matters what unwrap method I use, I always end up having 16 textures, even with ABF or LSCM My model has only one material in blender, only one UV set, and one island. I even tried to send my mesh without UVs to let mushroom unwrap it, but the node won't cook then. So is the node "Texturing" sharing some parameters with the "Meshing" one ? Is there a node I need to add or a particular pipeline I need to apply ? I only want to get a single island in my UVs and a single texture set.

fabiencastan commented 5 years ago

@QuentinJouanisson I don't understand. If you export your mesh after retopology with UVs done in Blender, the Texturing node will use these UVs. Could you double check if you really have UVs in your OBJ file?

QuentinJouanisson commented 5 years ago

@fabiencastan I do have UVs on my mesh, no doubts about that, but I found something else in the logs. It seems that the parameters for the texture node are messed up. For instance the downscale parameter return a "unsigned int" wich is weird because I'm using the gui, and therefore sliders in the interface... The version I'm running is the latest windows Zip I found on your website. Here's a screenshot of my pipeline if that can help understand a possible mistake I made.

Thank you for your support Fabien !

QJ_meshroom_pipeline_screenshot

quentinJ_logs.zip

fabiencastan commented 5 years ago

Can you send me your OBJ with retopo?

QuentinJouanisson commented 5 years ago

@fabiencastan no problem, have it there

retopology_pechdavid.zip

QuentinJouanisson commented 5 years ago

Updating to version 2019.2.0 resolved the issue

herrpedro commented 5 years ago

hi, did it solve the multiple textures too? (the main issue) thank you

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.

IlvisFaulbaums commented 2 years ago

After having two .png textures in Meshroom I used Meshlab. In Meshlab's latest version I used function "Texture Map Defragmentation" - it created one .png file for my .obj file. Then used in Blender it automatically opened my .obj with one texture .png file.

herrpedro commented 2 years ago

Thank you for your comment. my objective then was to publish to sketchfab and so i found that 3dfzephyr free does that i add the sketchfab api key to 3dfzephyr, open model, publish to sketchfab.