Page 1 of 1
viewing textured obj files
Posted: Thu May 22, 2014 4:28 pm
by jessie123
Hi,
I'm trying to view a very simple obj file, textured from a png. I open it in CloudCompare but it just shows up as gray. It shows up fine in Meshlab. Is this feature supported?
Here is my obj file:
mtllib floorplan.mtl
# Vertices
v 1 0 0
v 1 1 0
v 0 1 0
v 0 0 0
vn 0.0 0.0 1.0
vt 1 0
vt 1 1
vt 0 1
vt 0 0
# The material will be used for mesh 0
usemtl floorplan
# Faces
f 1/1/1 2/2/1 3/3/1
f 1/1/1 3/3/1 4/4/1
And here is my mtl file:
newmtl floorplan
Ka 0.2 0.2 0.2
Kd 0.8 0.8 0.8
Ks 1 1 1
d 1
Ns 0
illum 2
map_Kd floorplan.png
I am using:
CloudCompare V2
Version: 2.5.4 [Mac OS 64 bits]
Thank you so much!
Stav
Re: viewing textured obj files
Posted: Thu May 22, 2014 5:24 pm
by daniel
Well I put a fake png file next to the obj and mtl files you provided and it worked well (on Windows).
Does any (warning) message is displayed in the console when loading the file on your side?
Re: viewing textured obj files
Posted: Thu May 22, 2014 6:51 pm
by jessie123
Yes there were! I didn't even think to look there.
[14:51:10] [OBJ::Load::MTL parser] Failed to load texture file: /Users/test/Desktop/test/d floorplan.png
I double checked my mtl file, and the name is floorplan.png, and made sure that it still loads in Meshlab.
If I change my map_Kd to map_Ks I get a similar error:
[14:52:47] [OBJ::Load::MTL parser] Failed to load texture file: /Users/test/Desktop/test/s floorplan.png
Thank you so much!
Re: viewing textured obj files
Posted: Thu May 22, 2014 7:12 pm
by daniel
That's "funny". It means that the texture filename is wrongly imported from the mtl file on Mac OS only. CloudCompare reads two characters before the actual filename ("mapKd file.png" --> "d file.png"). I'll have to check with Andy - the Mac OS guy - but he's in vacations right now.
Do you compile the project by yourself or do you use Andy's package?
Re: viewing textured obj files
Posted: Thu May 22, 2014 7:32 pm
by jessie123
I use Andy's package
Re: viewing textured obj files
Posted: Thu May 29, 2014 8:28 am
by daniel
Well while waiting for Andy's return, can you send me the exact mtl file you used? (especially I want to know if there's hidden characters or spaces at the beginning of the 'mapKd' line).
Re: viewing textured obj files
Posted: Thu Jan 15, 2015 4:28 pm
by MikaEK
I had the same problem.
I updated my gcc from 4.2.1 to the latest 4.9.2 (for another reason) and now my obj model works in CC just as well as it works with meshlab.
I also use jpg instead of png images. In my obj file is 12 materials, 24 points and 4 tex.coord.
My CloudCompare version is 2.5.5 [Mac OS 64 bits] and I use 10.9.5 macbook(-08).
Here are links for the gcc update which I used:
https://wiki.helsinki.fi/display/HUGG/I ... n+Mac+OS+X
http://hpc.sourceforge.net
-mk-
I don't know if this helps you since I don't really know how the CC does all its magic..
Re: viewing textured obj files
Posted: Wed Jan 28, 2015 6:42 pm
by geotyr
I had a similar problem, but with windows
An obj file with mtl and jpg associated files.
When I loaded the obj file, I had the model with no texture and a message in the console saying that the jpg file could not be loaded.
I have tried modifying the mtl file in mutiple ways and nothing worked
I looked at the jpg file and it had a 20000x20000 pixels resolution. I resized the jpg file to 10000x10000 and it finally worked.
I did not test to see where is the limit.
Re: viewing textured obj files
Posted: Wed Jan 28, 2015 8:10 pm
by daniel
Not sure if there's an absolute limit (it may depend on the system, architecture, etc.). Qt is in charge of loading the image and it doesn't give any particular feedback (other than 'success' or 'failure'!).
But anyway, most graphic cards can't handle textures over 64 Mb (so even 100 Mb will be reduced before being sent to the GPU).