Results 1 to 2 of 2

Thread: texture coordinate mapping

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    3

    texture coordinate mapping

    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?

  2. #2
    Junior Member
    Join Date
    Aug 2008
    Posts
    6
    Hi,
    your understanding of the uvs is correct.
    But SketchUp exports texcoords that are not really useful, if your SketchUp model has no texture assigned to the geometry.
    I created a simple box without a texture assigned to it and exported it to COLLADA and found the s and t values of the uvs to be equal to one of the position coordinates. This uvs are not really helpful to texture your model.

    However, if your model has a texture assigned, the exported uvs are as expected.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •