[XNA] Writing exporter from SketchUp to X

Started by
1 comment, last by Zbychs 15 years, 8 months ago
(Edit: My .X file exporter for SketchUp - ZbylsXExporter) Hi there. There are no free good exporters from SketchUp to X files, nor a route Skp -> Collada -> Blender -> X worked for me (Blender has problems with SketchUp's Colladas). I've started writing an exporter to X files in Ruby (based on edecadoudal's exporter, and some other stuff). My exporter is simple, but still works a bit better than edecadoudal's. I've got texture coordinates *almost* properly exported, but I can't figure out how to export them *realy* properly. I'm stuck and out of ideas. Any help would be apreciated. Here's the overview: Some exporters, when they export UV's, use: face.mesh.uv_at(idx) But those UV's are not always correct (most of the time they're not for GoogleEarth imported models). edecadoudal use this technique. I use a different technique:

tw = Sketchup.create_texture_writer
tw.load(face, true)
tw.load(face, false)
tw.write_all("C:\\tmp\\tex", true)

uvHelp = face.get_UVHelper(true, true, tw)

#for each vertex
uv = uvHelp.get_front_UVQ(vertex.position).to_a
u = (uv.x/uv.z)
v = (uv.y/uv.z)

#Then I normalize them like this (hack?):
out_u = (u - min_u) / (max_u - min_u)
out_v = (v - min_v) / (max_v - min_v)



The problem is the UV's given by the UVHelper are in inches - but in inches in what coordinate system? I can't figure it out. (BTW: The size of a texture in inches is given by texture.width and texture.depth) I've pasted the most relevant part of the exporter here or here. Maybe if someone would help we could finally make an exporter for XNA/Indy/Other guys out there. Any ideas? Zbychs [Edited by - Zbychs on July 21, 2008 7:25:10 PM]
Advertisement
here is another sketchup exporter which work.

http://jamesewelch.wordpress.com/2008/03/07/how-to-load-a-google-sketchup-model-into-a-xna-game/
Quote:Original post by sunilsin
here is another sketchup exporter which work.

Thanks sunilsin, but actually it's the edecadoudal's exporter, which works poorly. 3drad's exporter is better, and mine works even better than those two, but still have problems when it comes to texture coordinates. I seem to doubt that there is a way to export uv's properly in Ruby SketchUp, and haven't found a way in C++ SDK either. Damn...

This topic is closed to new replies.

Advertisement