Ok, so I have a collada file that was obtained from Sketchup (free version) by exporting as google earth. I rename the .kmz file to a .zip, extract and there’s a .dae within.
I am using the Collada DOM library to load and render the model. That works fine.
The problem I’m having is that I now need to texture the model. Sketchup exported UV Coordinates in the dae file, so I figured I was good to go – I just needed to create a texture that wraps around the model properly to display as I want it to.
So I read up a little bit on UV coordinates, and as I understand it, they correspond to a percentage value of the width and height of an image… so usually between 0 and 1, but can be otherwise for looping textures or whatever. In my case, they are between 0 and 1.
From here I thought I could calculate X and Y values on the image by multiplying the UV coordinates by the size of image I want to use as a texture and then draw lines (per triangle) to show which parts of the image will map to which triangles. I wrote a simple PHP script utilizing GD to create this image.
The image looks similar to what I would expect, except that many faces are overlapping. I would have thought no face would overlap another. Would that be the way that the UV coordinates are created by Sketchup or am I misunderstanding what the UV coordinates represent?