[Plugin] Import OBJ with Materials v2.1 20131118

Re: [Plugin] Import OBJ with Materials- v1.3

Postby sepo » Thu Dec 24, 2009 12:15 am

Yes I know....I managed to import bigger file than that, It has just over 2mil edges.
0

sepo 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby TIG » Thu Dec 24, 2009 10:33 am

Well... after along time processing it the importer produced no geometry and no console warnings.
I also tried importing it into Blender... and that failed with an 'out of range error message', so there's something adrift in the obj file's geometry...
Seems your obj file has at least one problem that's giving at least two separate importers hiccups...
0
Last edited by TIG on Thu Dec 24, 2009 11:51 am, edited 1 time in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby sepo » Thu Dec 24, 2009 11:24 am

OK..thanks for trying.
0

sepo 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby monkey2007 » Mon Jan 11, 2010 11:21 pm

You Saved my day with this one! :ecstatic:
Need to import a lot obj. but it takes more then an hour to retexture it in Sketchup. Good work !!
0

monkey2007 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby halroach » Sun Feb 21, 2010 2:19 pm

nice plugin!
0
User avatar
halroach 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby pibuz » Mon Feb 22, 2010 5:44 pm

Sorry guys.. I don't want to spam this topic but I'd be very glad if someone could explain how to import correctly-mapped Xfrog trees into sketchy... :oops:
Sorry TIG if I go a little off-topic: I've stumbled on your topic because I am very interested in your plugin: you did a good work. A big thank you.
0

pibuz 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby ZFRPS » Fri Apr 16, 2010 5:59 pm

this idea is nice !

but this plugin is bad !
0
sketchup is bim

ZFRPS 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby TIG » Fri Apr 16, 2010 6:00 pm

zfrps wrote:this idea is nice !
but this plugin is bad !

Why is it ?
...
You write a better plugin then... it's a free country/world...
If my best isn't good enough then make it better, and share it...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby thomthom » Fri Apr 16, 2010 6:47 pm

zfrps wrote:but this plugin is bad !

Are you implying it's not working for you?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby Chris Fullmer » Fri Apr 16, 2010 6:56 pm

zfrps wrote:this idea is nice !

but this plugin is bad !


You're lack of details is astounding.....How about some useful information about what the plugin is or isn't doing? And maybe a test file that it fails on?
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby Fletch » Sun Apr 18, 2010 12:18 am

TIG, thanks for sharing this great plugin!
this plugin is bad
:lol: :roll:
to quote one of my favorite bands Flight of the Conchords "could you be more specific with your feedback, please?"
0

Fletch 
Twilight Render
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby jchau2007 » Mon Apr 19, 2010 5:47 pm

Tig I just wanted you to know that your constribution will never be forgotten as well as many other great plugin writers. Some times people just took these great plugins for granted. When something doesn't for an individual, they complained. Some of us don't know how fortunate we are to have all these great individuals to write up the plugins and given them for free. Wait til the plugin writer start charging people to have their plugins download... then people will go nutz.
0

jchau2007 
 

Re: [Plugin] Import OBJ with Materials- v1.3

Postby TIG » Mon Apr 19, 2010 9:20 pm

Thanks for the kind words... I know it's not perfect but it does work a lot of the time and there are work around for when the obj's format is incompatible...
I just got rankled at the lack of civility or useful criticism in that recent post - "if you can do better do it", was my challenge...
:roll:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby TIG » Mon Aug 16, 2010 4:40 pm

Here's v1.5 20100816 Missing 'group' in some types of OBJ code trapped [with "g OBJ"].
viewtopic.php?p=172790#p172790
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby xrok1 » Mon Aug 16, 2010 4:49 pm

;)
0
“There are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

http://www.Twilightrender.com try it!

xrok1 
 

Re: [Plugin] Import OBJ with Materials

Postby thomthom » Tue Aug 17, 2010 12:10 pm

I tried out this importer on a obj I had exported from SU - then edited in PS.
On importing it back to SU I noticed some errors. Attached is the model and screenshots from SU vs Max:

ViewSU01.png
ViewMax01.png


ViewSU02.png
ViewMax02.png



p.s.: the topic title doesn't reflect the current version. ;)
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import OBJ with Materials

Postby thomthom » Tue Aug 17, 2010 12:13 pm

Just noticed another glitch above the left front light.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import OBJ with Materials

Postby jsteacy » Tue Aug 24, 2010 4:00 pm

TIG, I tried using your script to import .obj files from this website www.modelplusmodel.com, and it doesn't work. note that it didn't work for the simlab importer as well, something about negative indexes of the faces. Can you look into it? Also reading through the posts trying to get a better understanding of the .obj file type. Does every obj file need a mtl file for materials and textures?
0

jsteacy 
Premium Member
Premium Member
 

Re: [Plugin] Import OBJ with Materials

Postby TIG » Tue Aug 24, 2010 7:31 pm

jsteacy wrote:TIG, I tried using your script to import .OBJ files from this website http://www.modelplusmodel.com, and it doesn't work. Note that it didn't work for the Simlab Importer as well, something about negative indexes of the faces. Can you look into it? Also reading through the posts trying to get a better understanding of the .OBJ file type. Does every OBJ file need an MTL file for materials and textures?

That site's free-sample bird 3DS file imported OK [in Pro] - see below...
BUT the OBJ file format... :roll:
To answer your questions first...
If there is no MTL file then there are no colors/materials in the resulting mesh.
If there is an MTL file but no images in the defined ../folder_path/file_name then there objects with materials specified will only get the color without the texture.

The f 123/123 124/124 125/125 is the correct way for a face to be specified in an OBJ file - this face is triangular, and uses vertices 123/124/125 [v] and the equivalent texture vertices [vt].
I can't see why their OBJ file format uses negative values at all !!! :?

My OBJ Importer is not foolproof... BUT can you point me at exact problem [OBJ[MTL] files... or PM me them ?
I can change my code to trap for any negative values for 'face indices' [see below]... BUT the imported object might end up being rubbish anyway ? I suspect that we need a miracle ?? :o
Capture.PNG
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby Jim » Tue Aug 24, 2010 8:01 pm

negative vertex references are legal in the .obj format.

f -1 -2 -3

this just means use the vertexes defined 1, 2, and 3 lines previous. Negative index values mean a relative offset from the current line. (I think. :roll: ) Not sure if it includes all lines, or just 'v' lines in the count, though.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby notareal » Tue Aug 24, 2010 8:09 pm

"BUT the imported object might end up being rubbish anyway ? I suspect that we need a miracle ??"
I believe it can be done... well just tested and Thea did import that 'F06 House bird' OK... sorry I don't have internal details how importer will actually handle this model.
0
Welcome to try Thea Render, Thea support | kerkythea.net -team member

notareal 
Thea Render Support
Thea Render Support
 

Re: [Plugin] Import OBJ with Materials

Postby Jim » Tue Aug 24, 2010 8:26 pm

Since Ruby has negative array indexes already, and the .obj is imported in at least a recognizable format, it may be something simple like an off-by-one error for negative indexes.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby jsteacy » Tue Aug 24, 2010 9:13 pm

I tried all of them including the house bird, and nothing gets imported. This is what I get from the console after I click the units to import to:
Code: Select all
Error: #<ArgumentError: Cannot convert argument to Sketchup::Point3d>
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:278:in `add'
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:278:in `run'
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:278:in `map'
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:278:in `run'
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:208:in `each'
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:208:in `run'
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:329
C:/Program Files/Google/Google SketchUp 7/Plugins/obj_importer.rb:329:in `call'


hope that helps
0

jsteacy 
Premium Member
Premium Member
 

Re: [Plugin] Import OBJ with Materials

Postby TIG » Tue Aug 24, 2010 9:16 pm

So if the face-indices are 'negative' then we work backwards through the face vertex lists ? - i.e we reverse the array of v's, and take the abs value as the index ? :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby Jim » Tue Aug 24, 2010 9:30 pm

Line 248:

Code: Select all
values.each do |v|
w = v.split("/")
vvv = Integer(w[0])
if vvv <= -2 # this
  vvv += 1
end
face<<Integer(vvv)
face_uvs.push(w[1].to_i)if w[1]


And maybe look at fill_from_mesh instead of add_faces_from_mesh. # Line 302. Probably left over from someone else..

587.png


I'm shocked it actually seems to have worked - it was just a hunch.
0
Hi

Jim 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby TIG » Wed Aug 25, 2010 9:30 am

Here's a slightly different version that I was working on independently - it also works !
viewtopic.php?p=172790#p172790 [v1.7 has fill from mesh changes too]
Capture.PNG
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby thomthom » Wed Aug 25, 2010 10:17 am

Any ideas what caused these glitches? viewtopic.php?f=323&t=20584&start=75#p264875
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Import OBJ with Materials

Postby TIG » Wed Aug 25, 2010 10:50 am

Thomthom, I assume you are referring to the size/units ?
If the file has a '# units = meters' line then the importer defaults to 'meters' [or whatever it says].
If it doesn't then it defaults to 'inches'.
However, as it starts a dialog lets you choose whatever units you'd like to use anyway [preset to those default units].
Some meshes don't form the tiny faces if the units are set too small - e.g. if you were to choose 'mm' when it was made in 'meters'. So if you are unclear about the units and none are specified then you can try out alternatives until you get a proper mesh without holes...
The reason the tool has three options is speed - 'as mesh' is fast but can fail when the OBJ code is convoluted; otherwise the textures can be added or not as desired.
The old sizing issue seems resolved.
PS: I can't tested your problem 'van' OBJ/MTL because PPartner010000.jpg wasn't in the zip file?
But I can see that its geometry seems a bit messed up around the side windows and the image file-names have spaces in them which confuses the MTL parser. I thought that you were 'recommended' to avoid having spaces in these paths/names - however, manually editing the MTL and the corresponding image-names so they are without spaces fixes that... BUT the 'PPartner010000.jpg' file is still missing altogether - see the Ruby Console error reporting :?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby TIG » Wed Aug 25, 2010 11:06 am

Busy today! Heres 1.8 - Trapped for spaces in image-names/paths.
viewtopic.php?p=172790#p172790
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Import OBJ with Materials

Postby thomthom » Wed Aug 25, 2010 11:19 am

TIG wrote:Thomthom, I assume you are referring to the size/units ?

No - it was the messed up geometry you noticed. You see it in the screenshots I posted - with the red circles.

TIG wrote:PS: I can't tested your problem 'van' OBJ/MTL because PPartner010000.jpg wasn't in the zip file?
But I can see that its geometry seems a bit messed up around the side windows and the image file-names have spaces in them which confuses the MTL parser. I thought that you were 'recommended' to avoid having spaces in these paths/names - however, manually editing the MTL and the corresponding image-names so they are without spaces fixes that... BUT the 'PPartner010000.jpg' file is still missing altogether - see the Ruby Console error reporting :?

The OBJ was initially created by SketchUp - then edited textures in PhotoShop.

I've attached the missing texture.

Will try v 1.8
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

PreviousNext


 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 11 guests

Visit our sponsors: