alicevision / Meshroom

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

Wrong values in mtl ? [bug] #863

Closed Saroder closed 3 years ago

Saroder commented 4 years ago

Hi guys,

Importing a .obj (with mtl and texture files) give me ...a big mess, textures are not right applied... Tried in Blender 2.82 (and a 2.90 alphabuild or something like this) Looking at the mtl I wonder if it's normal to get the same values for all my different texture files.

# 
# Wavefront material file
# Created with AliceVision
# 

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
newmtl TextureAtlas_1002
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_1002.png
newmtl TextureAtlas_1003
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_1003.png
newmtl TextureAtlas_1004
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_1004.png

Am I doing something wrong or there's a bug here, or somewhere ... ?

fabiencastan commented 4 years ago

Does it loads correctly in the Meshroom 3D viewer? Do you have the same problem on all datasets or only on a specific one?

Saroder commented 4 years ago

Thanx for trying to help, it's my first mesh... (I had, and still have much trouble on my other pc having Meshroom to work till the end...) In Meshroom it was OK, just loading in Blender (2.82) the texture are not oriented like they should be.

Saroder commented 4 years ago

I wanted to check again, but can't figure out how to reload the textured mesh in Meshroom (Have I to copy everything again in the Texturing folder ?). But I remember it was OK...

fabiencastan commented 4 years ago

You can drag&drop your OBJ file in the 3D viewer of Meshroom.

Saroder commented 4 years ago

Oh OK thank you I'll try (assuming it will find .mtl and .png in the same folder), too easy for me to think about it, I searched a few minute a (very?) old school "Load pictures" before I saw I could drag & drop :-/ But what do you think about the values in the .mtl, I'm just a newbie in 3D gfx but... for me it looks strange seeing no more details in the .mtl (I guess there are missing parts when I look at this : http://paulbourke.net/dataformats/mtl/ or https://people.cs.clemson.edu/~dhouse/courses/405/docs/brief-mtl-file-format.html, it looks like texture's mapping is missing in my mtl file)

fabiencastan commented 4 years ago

Your mtl looks fine.

Saroder commented 4 years ago

It looks fine ? OK... I just really don't know where are defined the places for the textures on the mesh, it's perhaps not in the mtl. (?)

It loaded right in Meshroom's 3D Viewer... I'll try to have a look at Blender again, I compute another mesh to try with it too... (While I still try to get Mushroom working on my faster computer, it doesn't wanna see the CUDA Nvidia using the latest pilotes for the card and with Cuda toolkit 8's driver it doesn't complain about having "no CUDA gfx card" but crashes the computer, after writing it can't "eject" the Gfx card ! (oO)

I thought most of people would work in blender after Meshroom finish his job, but I realize that probably most of people don't ^^ I was really not expecting such a problem to import in Blender -_-

Meshroom is really fine and the textured mesh is really nicer than I expected using only limited number of points on my limited computer, and only 76 smartphone's photos... People working on this soft really did a great job !

But the strange behavior about cuda on my fastest computer and the broken import in Blender on this one are driving me mad. I would probably buy a better computer soon being sure I could have everything working fine, but I have slowly more and more doubts :-(

natowi commented 4 years ago

Did you try setting the texture resolution in Texturing to a lower value? The texture might not be able to load due to hardware limitations. You can drag and drop the obj to Meshlab for testing.

Saroder commented 4 years ago

OK thanks, I'll have a look at this but in Meshroom 3D viewer it loads fine and blender loads my textures too , the problem is they're not in the right place or side. I saw the data for textures positioning is in the .obj and not in the .mtl as I first thought so I tried a 2 ways conversion obj> sthing>obj with a web converter... I'll try to see what happen like this too... Now all others problems with cuda and crashes in later nodes are solved so I keep hope to solve this last texture orientation issue... a big thank you for trying to help. Meshroom is nice enough for me to keep fighting 😁 I just really need to import his job in Blender... Can someone here import in Blender 2.82 (the last stable release) without problem ?

Le mer. 22 avr. 2020 à 08:34, natowi notifications@github.com a écrit :

Did you try setting the texture resolution in Texturing to a lower value? The texture might not be able to load due to hardware limitations. You can drag and drop the obj to Meshlab for testing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alicevision/meshroom/issues/863#issuecomment-617580158, or unsubscribe https://github.com/notifications/unsubscribe-auth/APHZFOWX66EDKTRYWHNM433RN2FWFANCNFSM4MM2XZ6A .

natowi commented 4 years ago

Did you enable the texture to show in the Blender Layout tab? (Viewport Shading: Material preview / default is solid)

blend2

Saroder commented 4 years ago

Thanks again natowi,

Yes I enabled textures, I'm not so lost or high :D Otherwise there would be NO texture at all ! ;-) But like this it's just ...a big mess. I tried to load the file from the online converter... but the converter just throw away the texture part -_-

Then I tried Meshlab and it loads my object and mtl fine,textured like in Meshrom 3D Viewer... I'm really happy about this !

So full of hopes I tried 3 export from meshlab with textures, results : OBJ =>(In blender 2.82) messy textures as before. DAE =>exactly the same messy textures as before again. PLY =>No textures... :'(

And if I load back those three files in Meshlab everything is OK, including the textures in the ply, they doesn't fly away...

I feel a lil bit desperate about blender imports, I can't believe there are compatibility problems like this nor that 3 file types imports are broken in Blender 2.82

In your screen capture, you imported a .obj from Meshroom in Blender 2.82 or another version ? Or... you just got this picture somehow or somewhere without making your own import from Meshroom object ?

natowi commented 4 years ago

I loaded the obj in Blender 2.82a, so it should work

Yes I enabled textures, I'm not so lost or high :D Otherwise there would be NO texture at all ! ;-) But like this it's just ...a big mess.

Sometimes one misses the small things, so I just wanted to be sure. (Rule one when troubleshooting: never assume anything ;-) )

Can you share a screenshot on how your "big mess" looks like? Maybe this can give a hint on the problem.

You can still try to manually apply the texture to your obj

Saroder commented 4 years ago

Oh you did it, so its only here... :O I dream it would work, I really don't understand why it doesn't but it looks more and more like it's on Blender's side... (I know often "PEBCAK" but... I guess it's something else here because yes I'm a newbie in 3D graphics -it's my really first photogrammetric try- but I'm not really a lambda user, I was yet programming little games and many other useless things 35 years ago ! And don't say I'm old, I'm just not so young now... :p)

Sometimes one misses the small things, so I just wanted to be sure. (Rule one when troubleshooting: never assume anything ;-) )

Sure, no problem.

A few times I wondered if a screen could be useful, now you ask for it so here it is : Sans titre untitled

And you can see with the third one that it's OK in Meshlab... but export from Meshlab to Blender leads to the same disaster... -_- BergerBois3_01

You can still try to manually apply the texture to your obj

Yes, as soon as I would learn how to do it I could... But I think it would be quite much work for nothing but a poor result.. :( I still want to believe we will really solve this problem. Hope the screens could help you or someone else to understand what happen and know how to avoid this result.

natowi commented 4 years ago

Do you have one or multiple texture files? It looks like there are multiple texture files and one or more are not loaded in blender. It might be worth a try to post this problem in the blender forum.

Saroder commented 4 years ago

I tried to ask in Blender chat... But I had no much help.

There are 4 textures and it looks like they are all loaded, but... I don't really know how they're applied -_-

Look at the very dark areas everywhere for example. I don't even really know where this black comes from, it looks darker than the shutter, and why it's everywhere.

But I'll investigate in this way, because some part of the textures are at the right places, others are missing, and I think some of them are maybe not at the right places... But there's maybe something to find about why some parts are at the right place and other parts are just missing...

I'll check texture's size limits in blender.

Thank you for continu trying natowi. :-)

Maybe being much more used to this kind of things you understand something seeing the textures ? They was too big to upload here, so reduced they are like this (they was between 20 and 34 MB). texture_1003_small texture_1004_small texture_1001_small texture_1002_small

natowi commented 4 years ago

Can you try again, using 1024 for texturing and ABF/LSCM in the texturing node? This should produce one texture file with more connected texture areas, which is easier to check. Then try again in Blender

Saroder commented 4 years ago

I'll try later, thx

(In blender the "Texture limit size" was off...)

I'm almost sure at the end it will appear it was a really stupid little thing ...but meanwhile I can't figure out what happen and it drives me crazy -_- It's OK in Meshlab but even in another file format saved from Meshlab, I can't load in Blender without having this problem with textures. Thinking about trying an old build of Blender... (But I tried yet an alpha 2.90 and the problem was the same)

Saroder commented 4 years ago

Computing with 1024/LSCM for texturing I had to decimate for my available memory, I did it quite a lot so the result is not nice but it loads fine in Blender... I'll try with such a decimated mesh but multiple textures...

schmebs commented 4 years ago

I once had trouble loading objs from Meshroom into other programs, until I discovered that Meshroom encodes the obj+mtl+png files in UDIM coordinates as default, which my other program (Meshmixer) couldn't handle. The "Use UDIM" option is in the texturing node. Try turning that off and see if it works.

Capture

Saroder commented 4 years ago

Thank you schmebs but it is not the problem, I had mesh created by Meshroom loading fine in blender with this "Use UDIM" box checked.

stale[bot] commented 3 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 3 years ago

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