|
Title: Sketchup to .OBJ exporter [solved] Post by: Ed 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 (http://sketchuptips.blogspot.com/2009/01/wavefront-obj-exporter-with-materials.html), 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? :-\ 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. Title: Re: Sketchup to .OBJ exporter (or "Help me debug broken ruby code") Post by: Kaelan 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? Title: Re: Sketchup to .OBJ exporter (or "Help me debug broken ruby code") Post by: Ed 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... (http://i294.photobucket.com/albums/mm90/tigshrimp/skptex.png) (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. Title: Re: Sketchup to .OBJ exporter [solved] Post by: Ed 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...] |