Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1025727 Posts in 41105 Topics- by 32711 Members - Latest Member: kerrybowden

July 23, 2014, 01:51:58 AM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Sketchup to .OBJ exporter [solved]
Pages: [1]
Print
Author Topic: Sketchup to .OBJ exporter [solved]  (Read 3682 times)
Ed
Level 5
*****



View Profile WWW
« on: May 29, 2009, 01:15:31 PM »

Woo hoo - this works now! See 4th (ish?) post below for fixed exporter. If anyone does want a .obj format loader for C#, PM me. You might need to modify it to store textures in however your game stores them, but it might be handy.

Original post:
Quote
I got this Sketchup .obj (and .matl) exporter script from here, but it turns out the UV values exported are total rubbish.
Well, they are for a certain style of skinning - namely the traditional games approach of putting all of the texture on a single page and texturing each face with a section of the whole page.

Anyone got any experience working with the Sketchup ruby interface (especially working with texture coords) or a fixed .obj file exporter, or any ideas at all?  Undecided

I'll edit in some example data...

Oh, and I can probably post up the exporter and the (C#) code to load .obj/.matl data if anyone's interested in using it themselves, I'll see if it's possible.
« Last Edit: May 30, 2009, 09:14:12 AM by Ed » Logged

Kaelan
Level 1
*


Malcontent

janus@luminance.org
View Profile WWW Email
« Reply #1 on: May 30, 2009, 12:57:25 AM »

I would be surprised if you could use sketchup's UV data for texturing purposes, unless you're actually applying your textures in sketchup. The last time I used it the texturing capabilities didn't extend any further than 'make this surface look like brick'.

I suspect that's why the data you're getting looks useless: It probably is.

Maybe try using some unwrap tool to generate UVs for the geometry?
Logged

Ed
Level 5
*****



View Profile WWW
« Reply #2 on: May 30, 2009, 08:33:39 AM »

That's what I though until fairly recently. It should be fine though - it certainly can do that kind of texturing internally, it's jus that something is going wrong on export.
Here's an example that I forgot to upload yesterday...



(In case you're wondering, you get this texturing tool by right-clicking on a face and selecting Texture->Position...)

For this model, the texture coordinates come out as:

  vt   0.2500  -0.2500 0.0000
  vt   0.0000  -0.0000 0.0000
  vt   0.2500   0.0000 0.0000
  vt   0.0000  -0.2500 0.0000
  vt   0.0000  -0.2500 0.0000
  vt   0.2500   0.0000 0.0000
  vt   0.2500  -0.2500 0.0000
  vt   0.0000  -0.0000 0.0000
  vt   0.0000   0.0000 0.0000
  vt   0.2500  -0.0000 0.0000
  vt   0.0000  -0.2500 0.0000


...etc. i.e. either 0, -0.25 or 0.25, which is clearly wrong, at least for the "roof" texture which should have a 0.5 in it.
Logged

Ed
Level 5
*****



View Profile WWW
« Reply #3 on: May 30, 2009, 09:22:51 AM »

Exporter code fix - just download the obj exporter from the link above, and change lines 598-599 where uq/vq are set to:

Code:
uq = (uvq.x)
vq = (uvq.y)

[I've let the author know as well...]
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic