AliceVision icon indicating copy to clipboard operation
AliceVision copied to clipboard

Why is the material color in .mtl file gray?

Open drkoller opened this issue 2 years ago • 0 comments

When a textured mesh is output at the end of the AliceVision photogrammetry pipeline by the Texturing::saveAsOBJ() method, the materials specified in the *.mtl file have a gray color for the ambient and diffuse attributes, like this:

newmtl TextureAtlas_1001
Ka  0.6 0.6 0.6
Kd  0.6 0.6 0.6
Ks  0.0 0.0 0.0
d  1.0
Ns  0.0
illum 2
map_Kd texture_1001.png

As a result of this medium gray material underlying the texture, meshes created in Meshroom appear unusually dark-colored when displayed with the default settings in many popular 3D viewers (Sketchfab, Meshlab, CloudCompare, etc.).

Most other popular photogrammetry software exports OBJ models with a fully white material underlying their textured meshes. For example, Agisoft Metashape does this:

newmtl myMaterial
Ka 1.0 1.0 1.0
Kd 1.0 1.0 1.0
Ks 0.0 0.0 0.0
d 1.0
Ns 0.0
illum 0
map_Kd myTexture.png

and RealityCapture does this:

newmtl myMaterial
Ka 1 1 1
Kd 1 1 1
d 1
Ns 0
illum 1
map_Kd myTexture.jpg

and Pix4D does this:

newmtl myMaterial
illum 0
map_Kd myTexture.jpg

and ContextCapture exports like this:

newmtl transferTex_0
Ka 1 1 1
Kd 1 1 1
d 1
Ns 0
illum 1
map_Kd Model_0.jpg

I think it is fair to say that the convention in photogrammetry software is to specify a white material underlying textured meshes, along with a constant color or diffuse (no specular) illumination model, when no more detailed reflectance properties of the textured material can be inferred. Textured meshes from these other programs appear lit and colored as expected when viewed in most 3D viewer software, whereas the Meshroom meshes have a dark cast due to the gray material.

Is there a good reason why the AliceVision OBJ output files use (0.6, 0.6, 0.6) for the material colors? If not, I would suggest changing the OBJ export routine to use the more conventional (1.0, 1.0, 1.0) material attributes. I realize that this might make meshes appear overly bright-colored in the Meshroom 3D viewer, but that could be easily corrected by adjusting the default lighting in the Meshroom viewer.

drkoller avatar Aug 26 '21 18:08 drkoller