viewing textured obj files

If you are allergic to bug trackers, you can post here any remarks, issues and potential bugs you encounter
Post Reply
jessie123
Posts: 3
Joined: Thu May 22, 2014 4:19 pm

viewing textured obj files

Post 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
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: viewing textured obj files

Post 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?
Daniel, CloudCompare admin
jessie123
Posts: 3
Joined: Thu May 22, 2014 4:19 pm

Re: viewing textured obj files

Post 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!
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: viewing textured obj files

Post 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?
Daniel, CloudCompare admin
jessie123
Posts: 3
Joined: Thu May 22, 2014 4:19 pm

Re: viewing textured obj files

Post by jessie123 »

I use Andy's package
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: viewing textured obj files

Post 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).
Daniel, CloudCompare admin
MikaEK
Posts: 1
Joined: Thu Jan 15, 2015 3:39 pm

Re: viewing textured obj files

Post 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..
geotyr
Posts: 18
Joined: Thu Jul 31, 2014 8:20 am

Re: viewing textured obj files

Post 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.
daniel
Site Admin
Posts: 7710
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: viewing textured obj files

Post 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).
Daniel, CloudCompare admin
Post Reply