Getting the correct uv



I’m currently working on importing sketchup model directly.

I’m using the SDK sample’s skp_to_xml as my reference. In the function CXmlExporter::WriteFace, I am using the output of SUMeshHelperGetSTQCoords and SUUVHelperGetUVQ to populate our uv buffer.

  1. In some cases, the models are texture correctly when directly using the uv values, in others it is very tiled.

  2. In case of the tiled textures if use the s_scale & t_scale returned from SUTextureGetDimensions i.e. & info.texture_tscale_ like something below,

    float fFrontFaceTexCoordU = (float)info.vertices_[dwVert].front_texture_coord_.x() * texture_sscale_;
    float fFrontFaceTexCoordV = -(float)info.vertices_[dwVert].front_texture_coord_.y() * texture_tscale_;

    the tiled texture looks correct.

I wasn’t clear on what is the correct way of getting the final UVs?